Skip to content
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

Merged
merged 2 commits into from
Nov 20, 2018
Merged

Fix stability hole with static _ #55983

merged 2 commits into from
Nov 20, 2018

Conversation

oli-obk
Copy link
Contributor

@oli-obk oli-obk commented Nov 15, 2018

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.

@oli-obk oli-obk added the beta-nominated Nominated for backporting to the compiler in the beta channel. label Nov 15, 2018
@rust-highfive
Copy link
Collaborator

r? @pnkfelix

(rust_highfive has picked a reviewer for you, use r? to override)

@rust-highfive rust-highfive added the S-waiting-on-review Status: Awaiting review from the assignee but also interested parties. label Nov 15, 2018
@petrochenkov
Copy link
Contributor

Hmm, this is not even a part of the RFC.
Looks like this happened accidentally because fn parse_item_const is used for both constants and statics.

@oli-obk
Copy link
Contributor Author

oli-obk commented Nov 15, 2018

Well, in any case we should block this from ending up in stable.

@rust-highfive

This comment has been minimized.

@oli-obk
Copy link
Contributor Author

oli-obk commented Nov 17, 2018

r? @nikomatsakis (reviewer suggestion from github)

@nikomatsakis nikomatsakis added the beta-accepted Accepted for backporting to the compiler in the beta channel. label Nov 19, 2018
@alexcrichton alexcrichton added this to the Rust 2018 Release milestone Nov 19, 2018
@alexcrichton
Copy link
Member

@bors: p=1

beta nominated

@Mark-Simulacrum
Copy link
Member

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+

@bors
Copy link
Contributor

bors commented Nov 20, 2018

📌 Commit 9b87911 has been approved by Mark-Simulacrum

@bors bors added S-waiting-on-bors Status: Waiting on bors to run and complete tests. Bors will change the label on completion. and removed S-waiting-on-review Status: Awaiting review from the assignee but also interested parties. labels Nov 20, 2018
@bors
Copy link
Contributor

bors commented Nov 20, 2018

⌛ Testing commit 9b87911 with merge 046e054...

bors added a commit that referenced this pull request Nov 20, 2018
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.
@bors
Copy link
Contributor

bors commented Nov 20, 2018

☀️ Test successful - status-appveyor, status-travis
Approved by: Mark-Simulacrum
Pushing 046e054 to master...

@bors bors merged commit 9b87911 into rust-lang:master Nov 20, 2018
@nikomatsakis nikomatsakis mentioned this pull request Nov 20, 2018
20 tasks
@alexcrichton alexcrichton removed the beta-nominated Nominated for backporting to the compiler in the beta channel. label Nov 20, 2018
bors added a commit that referenced this pull request Nov 20, 2018
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)
bors added a commit that referenced this pull request Dec 6, 2018
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.
@oli-obk oli-obk deleted the static_ branch June 15, 2020 15:29
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
beta-accepted Accepted for backporting to the compiler in the beta channel. S-waiting-on-bors Status: Waiting on bors to run and complete tests. Bors will change the label on completion.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

8 participants