-
Notifications
You must be signed in to change notification settings - Fork 12.8k
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
More thread-safety changes #49390
More thread-safety changes #49390
Conversation
@rust-lang/compiler Does anybody know what |
It's a hack! But it's used. |
@petrochenkov Why do we keep the AST around in the token stream though? It seems more correct to use the original TokenStream instead of relying on an lossy AST -> TokenStream transformation |
Who knows. |
Ping from triage, @michaelwoerister ! |
@@ -927,8 +928,13 @@ impl<'hir> Map<'hir> { | |||
} | |||
|
|||
pub fn intern_inlined_body(&self, def_id: DefId, body: Body) -> &'hir Body { | |||
let mut inlined_bodies = self.inlined_bodies.borrow_mut(); | |||
if let Some(&b) = inlined_bodies.get(&def_id) { | |||
debug_assert_eq!(&body, b); |
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.
How can this condition hold? body
is on the stack and b
is in the arena. Am I overlooking something?
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.
This isn't a pointer comparison. This check ensures that we always give the same body for the same def_id to intern_inlined_body.
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.
Oh, you're right of course :)
@Zoxc, looks good to me except for |
@bors r+ |
📌 Commit 1e3f638 has been approved by |
More thread-safety changes r? @michaelwoerister
☀️ Test successful - status-appveyor, status-travis |
r? @michaelwoerister