Repository navigation
A parameter's completed effects survive the recheck of a concrete specialization - #3619
Merged
Merged
Conversation
…cialization; audit:effects runs after MIR and names the functions
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
The bug. Any program that sorts with a closure (
xs.sort_by((a, b) => …)) failedwith analyze … audit:all: "effect edge … is not at fixpoint". Reproduced on main with a six-line program. No runtime symptom was found (a comparison that owns a list sorts with no double free and no leak under the debug allocator), but the effects table the later stages read was wrong for that instance.Root cause, from the debugger.
List.sort_bypasses its comparison toby_compare, where it escapes into the returned closure. The effect fixpoint givessort_by's parameter "consume + escapes". MIR lowering then checks each concrete specialization again (lower_concrete_specialization), and that recheck gives the signature fresh, zeroed effect slots (SemaCheck, where it already restores the value-ref flags for the same reason) and flushes only the body's own notes: "consume". The completed bit is gone.The fix. Sema records that the fixpoint has run (
effect_flow_settled). A signature re-registered after it starts from its completed effects, and the flush adds to them.Two tool defects on the way, fixed here.
audit:effectsrun by itself aborted ("is_copy_frozen miss"): it ran as a snapshot before the copy-ness table it reads was complete, and before the rechecks it should judge. It now runs after MIR, as it does insideaudit:all.Test.
behav_effects_survive_specialization_recheck: run,audit:all,audit:effects. Shown failing before the fix (exit 134).Evidence. Battery GREEN on e67a1c531 (the top of the stack this is the base of);
:release-checksgreen on the same commit.