-
Notifications
You must be signed in to change notification settings - Fork 13k
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
Internal compiler error: "entered unreachable code: we captured two identical projections" #89606
Comments
@rustbot label: +regression-from-stable-to-beta |
Reduced: pub struct S<'a> {
o: Option<&'a i32>,
}
fn foo(s: &mut S) {
|| {
let S { o } = s;
s.o = None;
};
} |
This assertion is indeed introduced in #89208. The two captures have the same place but different CaptureInfo. |
Interesting. It's a bit hard to imagine how #89208 could have introduced this, since that just sorts a list. Fascinating! Maybe somebody from @rust-lang/wg-rfc-2229 has a clue? |
Actually, it's not at all hard to imagine, because #89208 introduced the following: rust/compiler/rustc_typeck/src/check/upvar.rs Lines 665 to 668 in d480cef
The projections are actually the same, but the types differ in regions, which probably means that this comment is wrong: rust/compiler/rustc_typeck/src/check/upvar.rs Lines 619 to 622 in d480cef
|
Yeah, I just checked and the region of the match is an inferenced variable and |
Assigning priority as discussed in the Zulip thread of the Prioritization Working Group. @rustbot label -I-prioritize +P-critical |
Did some analysis:
@wesleywiser I can submit a PR if you haven't started |
@nbdd0121 I just started looking at it but if you have a solution, go for it! Happy to review your PR 🙂 |
@nbdd0121 I'm not sure about region code that much but regionchk uses the regions created: I think at one point mentioned getting rid of the region field entirely in UpvarBorrow, but since it wasn't required the discussion didn't proceed. Also it's more like this is a bug of the capture analysis than the sorting. We should never have two same places going into min capture in the list. |
I was thinking about erasing the region from |
This bug popped up in CI on a project of ours. This does not reproduce on stable, but does reproduce on nightly and the latest beta (
1.56.0-beta.4
). Bisection shows thatnightly-2021-09-26
was the first build with the regression. Further bisection points to 6867dd2 being the commit that introduced the regression. If I had to guess from the PRs in the rollup I'd say #89208 seems the most likely, since it touched the code around the error source.Code
Meta
rustc --version --verbose
:Error output
Backtrace
The text was updated successfully, but these errors were encountered: