-
Notifications
You must be signed in to change notification settings - Fork 12.7k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Use NodeId/HirId instead of DefId for local variables. #44316
Conversation
5027135
to
b175d84
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Nice! It's a bit unfortunate that Def::def_id()
can't be used as universally anymore but that's OK. Having fewer DefIds is definitely a win.
One question though: Won't we run into trouble with MIR inlining here as it potentially mixes in locals from other crates?
def_id.map(|id| id_from_def_id(id)).unwrap_or_else(|| { | ||
// Create a *fake* `DefId` out of a `NodeId` by subtracting the `NodeId` | ||
// out of the maximum u32 value. This will work unless you have *billions* | ||
// of definitions in a single crate (very unlikely to actually happen). |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
OK.. :D
rls_data::Id
should arguably be switched to a (DefPathHash, LocalId)
anyway at some point.
Where does MIR refer to variable bindings by some kind of ID? If it does that's a bug IMO. |
☔ The latest upstream changes (presumably #44380) made this pull request unmergeable. Please resolve the merge conflicts. |
r=me once rebased. |
97b32ae
to
1492fcf
Compare
@bors r=michaelwoerister |
📌 Commit 1492fcf has been approved by |
☔ The latest upstream changes (presumably #44142) made this pull request unmergeable. Please resolve the merge conflicts. |
1492fcf
to
da0a47a
Compare
@bors r=michaelwoerister |
📌 Commit da0a47a has been approved by |
Use NodeId/HirId instead of DefId for local variables. r? @michaelwoerister
☀️ Test successful - status-appveyor, status-travis |
Use LocalDefId instead of HirId for reachable_set elements. The only `HirId`s being tracked there that don't have matching `DefId`s are local variables, and that's an accident from rust-lang#44316 (where I preserved the old behavior, even if nothing relied on reachability tracking local variables).
Use LocalDefId instead of HirId for reachable_set elements. The only `HirId`s being tracked there that don't have matching `DefId`s are local variables, and that's an accident from rust-lang#44316 (where I preserved the old behavior, even if nothing relied on reachability tracking local variables).
r? @michaelwoerister