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

NLL: cast causes failure to promote to static #55385

Merged
merged 3 commits into from
Oct 27, 2018

Conversation

davidtwco
Copy link
Member

Fixes #55288. See commit messages for more details.

r? @oli-obk
cc @nikomatsakis
cc @pnkfelix
cc @RalfJung

@rust-highfive rust-highfive added the S-waiting-on-review Status: Awaiting review from the assignee but also interested parties. label Oct 26, 2018
src/librustc/mir/visit.rs Outdated Show resolved Hide resolved
PlaceContext::NonUse(NonUseContext::StorageDead) |
PlaceContext::NonUse(NonUseContext::AscribeUserTy) |
PlaceContext::NonUse(NonUseContext::Validate) => false,
}
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

What is this used for? It's a new classification, isn't it?

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I moved this function from another pass that I stumbled upon while making changes, it was used in a handful of places and was being imported from that pass.

src/librustc/mir/visit.rs Outdated Show resolved Hide resolved
pub enum PlaceContext<'tcx> {
NonMutatingUse(NonMutatingUseContext),
MutatingUse(MutatingUseContext),
MaybeMutatingUse(MaybeMutatingUseContext<'tcx>),
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is not nice... now we have a mixture of type-based classification and dynamic classification, not getting the benefits of either of them.

Given this, I don't think it makes any sense to separate the enum into 4.

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I've modified this to remove the fourth variant. It's still not ideal, because there are now three borrow variants, but I think it is cleaner than with four variants.

src/librustc/mir/visit.rs Outdated Show resolved Hide resolved
src/librustc/mir/visit.rs Outdated Show resolved Hide resolved
src/librustc_codegen_llvm/mir/analyze.rs Outdated Show resolved Hide resolved
src/librustc_mir/transform/const_prop.rs Outdated Show resolved Hide resolved
src/librustc_mir/transform/simplify.rs Show resolved Hide resolved
@rust-highfive

This comment has been minimized.

@oli-obk
Copy link
Contributor

oli-obk commented Oct 26, 2018

@bors r+ 🏎️

@bors
Copy link
Contributor

bors commented Oct 26, 2018

📌 Commit dcaf3fd2f7b45ca4cf80aaa3be312b6b886e9c33 has been approved by oli-obk

@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 Oct 26, 2018
@nikomatsakis
Copy link
Contributor

@bors p=1

This is an RC2 "nice to have"

@bors

This comment has been minimized.

@bors bors added S-waiting-on-author Status: This is awaiting some action (such as code changes or more information) from the author. and removed S-waiting-on-bors Status: Waiting on bors to run and complete tests. Bors will change the label on completion. labels Oct 26, 2018
@bors

This comment has been minimized.

@davidtwco
Copy link
Member Author

@bors r=oli-obk

@bors
Copy link
Contributor

bors commented Oct 26, 2018

📌 Commit 6b33189b7f7d07544563b92a55edce0240327fa4 has been approved by oli-obk

@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-author Status: This is awaiting some action (such as code changes or more information) from the author. labels Oct 26, 2018
@bors

This comment has been minimized.

@bors bors added S-waiting-on-author Status: This is awaiting some action (such as code changes or more information) from the author. and removed S-waiting-on-bors Status: Waiting on bors to run and complete tests. Bors will change the label on completion. labels Oct 27, 2018
@bors

This comment has been minimized.

This commit adds logging statements to `promote_consts` and
`qualify_consts` to make it easier to understand what it is doing.
@davidtwco
Copy link
Member Author

@bors r=oli-obk

@bors
Copy link
Contributor

bors commented Oct 27, 2018

📌 Commit 6208bd8 has been approved by oli-obk

@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-author Status: This is awaiting some action (such as code changes or more information) from the author. labels Oct 27, 2018
@pnkfelix
Copy link
Member

@bors p=1

As mentioned above, this is nice to have for RC2, so we are trying to win the race to get it in before beta cutoff

@bors
Copy link
Contributor

bors commented Oct 27, 2018

⌛ Testing commit 6208bd8 with merge a47da3a38c1ffaa0805525fc5e1a0a92b4216303...

@bors

This comment has been minimized.

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

@bors retry

@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 Oct 27, 2018
@oli-obk
Copy link
Contributor

oli-obk commented Oct 27, 2018

@bors retry

@bors
Copy link
Contributor

bors commented Oct 27, 2018

⌛ Testing commit 6208bd8 with merge b3b8760...

bors added a commit that referenced this pull request Oct 27, 2018
NLL: cast causes failure to promote to static

Fixes #55288. See commit messages for more details.

r? @oli-obk
cc @nikomatsakis
cc @pnkfelix
cc @RalfJung
@bors
Copy link
Contributor

bors commented Oct 27, 2018

☀️ Test successful - status-appveyor, status-travis
Approved by: oli-obk
Pushing b3b8760 to master...

@bors bors merged commit 6208bd8 into rust-lang:master Oct 27, 2018
@bors bors mentioned this pull request Oct 27, 2018
@davidtwco davidtwco deleted the issue-55288 branch October 27, 2018 20:10
@pietroalbini
Copy link
Member

Nominating for beta backport, since this fixes a beta regression.

cc @rust-lang/compiler

@pietroalbini pietroalbini added the beta-nominated Nominated for backporting to the compiler in the beta channel. label Nov 19, 2018
@nikomatsakis nikomatsakis added the beta-accepted Accepted for backporting to the compiler in the beta channel. label Nov 19, 2018
@alexcrichton alexcrichton removed the beta-nominated Nominated 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
@nikomatsakis nikomatsakis mentioned this pull request Nov 20, 2018
20 tasks
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)
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.

9 participants