Repository navigation
Consumed map/set keys are moved; migrator macro capture and probe fixed (#2265) - #2267
Merged
Merged
Conversation
…e is moved; the migrator's macro capture and probe work again (#2265) Three layered bugs. Sema never marked the owned key of those builtins moved while MIR lowered it as a move, so a later use compiled and read the blanked string. The migrator's capture used `name` after `remove(name)`, so every macro was stored under "" and its literal fallback depended on which names other paths happened to look up. And every pcre2 unit's clang probe hit clang's 20-error limit, whose location-less note read as a header error and discarded the whole batch. Sema marks those keys moved (four compile-error tests); the capture drops the needless remove (insert replaces); parses pass -ferror-limit=0. The corpora are regenerated: constants now carry clang's typed, folded values, and every corpus passes its own tests.
Contributor
Author
|
Battery GREEN on f51fcec (gate, uat, battery-checks: fixpoint, drop and move audits, every test target). |
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.
Fixes #2265. Three layered bugs, found with the debugger and temporary diagnostics (none committed):
HashMap.remove,increment,decrementandHashSet.removetake an owned key that MIR lowers as a move, but Sema never marked the binding moved.let a = mk(); m.remove(a); print(a)compiled and printed an empty string. Sema now marks it (beside the store ruleinsertalready uses). Four compile-error tests fail on main and pass here. The only violation in the tree was the migrator.ci_capture_macro_valuesusednameafterremove(name), so every macro landed under the key""and the per-file cache was empty. That made a macro's translation depend on which names other paths had looked up.insertalready replaces, so theremoveis gone.-ferror-limit=0.Corpora. Regenerated with each corpus's own test suite passing before promotion. pcre2's defs now carry clang's typed, folded constants (and some constants the text fallback could not spell); zlib folds three constants and names
EWOULDBLOCKas its source does (defined per target in std.libc).Gate, deep-debug-tool-tests and drop-audit green.
Open question for Eric (not changed here): D22 leaves the key mode of
removeto the map's API. Today it consumes the key, som.remove(k)followed by a use ofkneedsm.remove(k.clone()).get/containsobserve their key. Makingremoveobserve too would match them and Rust'sremove(&Q).