-
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
Fix stability hole with static _
#55983
Conversation
r? @pnkfelix (rust_highfive has picked a reviewer for you, use r? to override) |
Hmm, this is not even a part of the RFC. |
Well, in any case we should block this from ending up in stable. |
This comment has been minimized.
This comment has been minimized.
r? @nikomatsakis (reviewer suggestion from github) |
@bors: p=1 beta nominated |
I'm going to accept this as it seems like the correct fix and we're rather close on deadlines (and is largely just making something "even more" unstable, so probably can't hurt to land/backport). @bors r+ |
📌 Commit 9b87911 has been approved by |
Fix stability hole with `static _` The `underscore_const_names` only gated const items with `_` as the name. `static _: () = ();` works on beta without feature gates right now, this PR fixes that.
☀️ Test successful - status-appveyor, status-travis |
beta backport rollup Backports of some beta-approved PRs - [x] #55385: NLL: cast causes failure to promote to static - [x] #56043: remove "approx env bounds" if we already know from trait - [x] #56003: do not propagate inferred bounds on trait objects if they involve `Self` - [x] #55852: Rewrite `...` as `..=` as a `MachineApplicable` 2018 idiom lint - [x] #55804: rustdoc: don't inline `pub use some_crate` unless directly asked to - [x] #56059: Increase `Duration` approximate equal threshold to 1us - [x] Keep resolved defs in path prefixes and emit them in save-analysis #54145 - [x] Adjust Ids of path segments in visibility modifiers #55487 - [x] save-analysis: bug fix and optimisation. #55521 - [x] save-analysis: be even more aggressive about ignorning macro-generated defs #55936 - [x] save-analysis: fallback to using path id #56060 - [x] save-analysis: Don't panic for macro-generated use globs #55879 - [x] Add temporary renames to manifests for rustfmt/clippy #56081 - [x] Revert #51601 #56049 - [x] Fix stability hole with `static _` #55983 - [x] #56077 - [x] Fix Rustdoc ICE when checking blanket impls #55258 - [x] Updated RELEASES.md for 1.31.0 #55678 - [x] ~~#56061~~ #56111 - [x] Stabilize `extern_crate_item_prelude` #56032 Still running tests locally, and I plan to backport @nrc's other PRs too (cc @petrochenkov -- thanks for the advice)
Delay gensym creation for "underscore items" (`use foo as _`/`const _`) until name resolution So they cannot be cloned by macros. See #56303 for the discussion. Mostly fix cross-crate use of underscore items by inverting the "gensyms are lost in metadata" bug as described in #56303 (comment). Fix unused import warnings for single-segment imports (first commit) and `use crate_name as _` imports (as specified in #56303 (comment)). Prohibit accidentally implemented `static _: TYPE = EXPR;` (cc #55983). Add more tests for `use foo as _` imports.
The
underscore_const_names
only gated const items with_
as the name.static _: () = ();
works on beta without feature gates right now, this PR fixes that.