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

Allow inference regions when relating consts #73225

Merged
merged 1 commit into from
Jun 12, 2020

Conversation

tmandry
Copy link
Member

@tmandry tmandry commented Jun 11, 2020

As first noticed by @eddyb, super_relate_consts doesn't need to check for inference vars since eval does it already (and handles lifetimes correctly by erasing them).

Fixes #73050

r? @oli-obk

@rust-highfive rust-highfive added the S-waiting-on-review Status: Awaiting review from the assignee but also interested parties. label Jun 11, 2020
@tmandry tmandry added the beta-nominated Nominated for backporting to the compiler in the beta channel. label Jun 11, 2020
@tmandry
Copy link
Member Author

tmandry commented Jun 11, 2020

Nominating for backport as this fixes a stable-stable regression.

@oli-obk
Copy link
Contributor

oli-obk commented Jun 12, 2020

@bors r+

@bors
Copy link
Contributor

bors commented Jun 12, 2020

‼️ Invalid head SHA found, retrying: 0000000000000000000000000000000000000000

@bors
Copy link
Contributor

bors commented Jun 12, 2020

📌 Commit d794313 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 Jun 12, 2020
bors added a commit to rust-lang-ci/rust that referenced this pull request Jun 12, 2020
Rollup of 5 pull requests

Successful merges:

 - rust-lang#72906 (Migrate to numeric associated consts)
 - rust-lang#73178 (expand: More precise locations for expansion-time lints)
 - rust-lang#73225 (Allow inference regions when relating consts)
 - rust-lang#73236 (Clean up E0666 explanation)
 - rust-lang#73273 (Fix Zulip pings)

Failed merges:

r? @ghost
@bors bors merged commit 6f9d453 into rust-lang:master Jun 12, 2020
@spastorino spastorino added the T-compiler Relevant to the compiler team, which will review and decide on the PR/issue. label Jun 17, 2020
@pnkfelix
Copy link
Member

Discussed at T-compiler meeting; approved for beta backport.

@pnkfelix pnkfelix added the beta-accepted Accepted for backporting to the compiler in the beta channel. label Jun 18, 2020
Comment on lines +5 to +8
async fn foo<'a>() {
let _data = &mut [0u8; { 1 + 4 }];
bar().await
}
Copy link
Member

Choose a reason for hiding this comment

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

Weird that this would need async, presumably fn foo<'a: 'a> (forcing lifetime parameters aka "early-bound" as opposed to only the signature being lifetime-polymorphic aka "late-bound) would also work?

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 can't get it to ICE: playground

The ICE happened when unifying the generator witness with the generator type (IIRC?), so maybe there's something special about that operation.

let eagerly_eval = |x: &'tcx ty::Const<'tcx>| {
// FIXME(eddyb) this doesn't account for lifetime inference variables
// being erased by `eval`, *nor* for the polymorphic aspect of `eval`.
// That is, we could always use `eval` and it will just return the
// old value back if it doesn't succeed.
if !x.val.needs_infer() {
return x.eval(tcx, relation.param_env()).val;
}
x.val
};
let eagerly_eval = |x: &'tcx ty::Const<'tcx>| x.eval(tcx, relation.param_env()).val;
Copy link
Member

@eddyb eddyb Jun 18, 2020

Choose a reason for hiding this comment

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

I think this makes sense. I left that FIXME comment (and the one below) while working on an unrelated PR #71049 (and glancing at code next to what I was touching). I should've probably filed issues.

At least I don't think this FIXME was a soundness problem, the overzealous check could only lead to types failing to equate (which could mean ICEs, clearly it happened here so it's possible).

This is reminiscent of #70773, where missing normalizations started showing up after we stopped ignoring generics in scope, in #70452.

I wonder if changing this one piece of code in relate makes the extra normalizations added to fix #70773 unnecessary.

@Mark-Simulacrum Mark-Simulacrum removed the beta-nominated Nominated for backporting to the compiler in the beta channel. label Jun 26, 2020
bors added a commit to rust-lang-ci/rust that referenced this pull request Jun 27, 2020
…ulacrum

[beta] backports

This PR backports the following:

* Make novel structural match violations not a `bug` rust-lang#73446
* linker: Never pass `-no-pie` to non-gnu linkers rust-lang#73384
* Disable the `SimplifyArmIdentity` pass rust-lang#73262
* Allow inference regions when relating consts rust-lang#73225
* Fix link error with #[thread_local] introduced by rust-lang#71192 rust-lang#73065
* Ensure stack when building MIR for matches rust-lang#72941
* Don't create impl candidates when obligation contains errors rust-lang#73005

r? @ghost
@tmandry tmandry deleted the issue-73050 branch October 3, 2020 22:40
@cuviper cuviper added this to the 1.46 milestone May 2, 2024
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. T-compiler Relevant to the compiler team, which will review and decide on the PR/issue.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

ICE: src/librustc_typeck/check/generator_interior.rs:204: impossible case reached
9 participants