-
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
Do not encode gensymed imports in metadata #59296
Conversation
r? @estebank (rust_highfive has picked a reviewer for you, use r? to override) |
@@ -312,7 +312,7 @@ impl<'a> Resolver<'a> { | |||
Ident::new(keywords::SelfLower.name(), new_span) | |||
), | |||
kind: ast::UseTreeKind::Simple( | |||
Some(Ident::new(keywords::Underscore.name().gensymed(), new_span)), | |||
Some(Ident::new(Name::gensym("__dummy"), new_span)), |
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.
Doesn't this shift the problem to the possible existence of __dummy
somewhere in the namespace?
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.
No, it's still a gensym, so it doesn't conflict with anything locally + it's not written into metadata since it's no longer an underscore.
(Previously it wasn't written due to the binding.vis != ty::Visibility::Invisible
condition, but I removed it to simplify things a bit.)
@bors r+ |
📌 Commit 30d5dc9 has been approved by |
Do not encode gensymed imports in metadata (Unless they are underscore `_` imports which are re-gensymed on crate loading, see rust-lang#56392.) We cannot encode gensymed imports properly in metadata and if we encode them improperly, we can get erroneous name conflicts downstream. Gensymed imports are produced by the compiler, so we control their set, and can be sure that none of them needs being encoded for use from other crates. A workaround that fixes rust-lang#59243.
Do not encode gensymed imports in metadata (Unless they are underscore `_` imports which are re-gensymed on crate loading, see rust-lang#56392.) We cannot encode gensymed imports properly in metadata and if we encode them improperly, we can get erroneous name conflicts downstream. Gensymed imports are produced by the compiler, so we control their set, and can be sure that none of them needs being encoded for use from other crates. A workaround that fixes rust-lang#59243.
Rollup of 7 pull requests Successful merges: - #59213 (Track changes to robots.txt) - #59239 (Remove inline assembly from hint::spin_loop) - #59251 (Use a valid name for graphviz graphs) - #59296 (Do not encode gensymed imports in metadata) - #59328 (Implement specialized nth_back() for Box and Windows.) - #59355 (Fix ICE with const generic param in struct) - #59377 (Correct minimum system LLVM version in tests)
(Unless they are underscore
_
imports which are re-gensymed on crate loading, see #56392.)We cannot encode gensymed imports properly in metadata and if we encode them improperly, we can get erroneous name conflicts downstream.
Gensymed imports are produced by the compiler, so we control their set, and can be sure that none of them needs being encoded for use from other crates.
A workaround that fixes #59243.