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

internal compiler error: unexpected lifetime bound #68890

Closed
dwrensha opened this issue Feb 6, 2020 · 6 comments · Fixed by #69014
Closed

internal compiler error: unexpected lifetime bound #68890

dwrensha opened this issue Feb 6, 2020 · 6 comments · Fixed by #69014
Labels
C-bug Category: This is a bug. E-needs-bisection Call for participation: This issue needs bisection: https://github.com/rust-lang/cargo-bisect-rustc glacier ICE tracked in rust-lang/glacier. I-ICE Issue: The compiler panicked, giving an Internal Compilation Error (ICE) ❄️ P-medium Medium priority regression-from-stable-to-beta Performance or correctness regression from stable to beta. T-compiler Relevant to the compiler team, which will review and decide on the PR/issue.

Comments

@dwrensha
Copy link
Contributor

dwrensha commented Feb 6, 2020

I'm seeing an internal compiler error on the following input (found by fuzz-rustc):

$ echo "enum e{A((?'a a+?+l))}" > main.rs
$ rustc main.rs
error: `?` may only modify trait bounds, not lifetime bounds
 --> main.rs:1:11
  |
1 | enum e{A((?'a a+?+l))}
  |           ^

error: expected one of `)`, `+`, or `,`, found `a`
 --> main.rs:1:15
  |
1 | enum e{A((?'a a+?+l))}
  |               ^ expected one of `)`, `+`, or `,`

error: internal compiler error: unexpected lifetime bound
 --> main.rs:1:11
  |
1 | enum e{A((?'a a+?+l))}
  |           ^^^

thread 'rustc' panicked at 'Box<Any>', <::std::macros::panic macros>:2:4
note: run with `RUST_BACKTRACE=1` environment variable to display a backtrace

note: the compiler unexpectedly panicked. this is a bug.

note: we would appreciate a bug report: https://github.com/rust-lang/rust/blob/master/CONTRIBUTING.md#bug-reports

note: rustc 1.43.0-nightly (58b834344 2020-02-05) running on x86_64-unknown-linux-gnu

error: aborting due to 3 previous errors

The error happens on nightly and beta but not on stable.

@jonas-schievink jonas-schievink added C-bug Category: This is a bug. I-ICE Issue: The compiler panicked, giving an Internal Compilation Error (ICE) ❄️ I-nominated regression-from-stable-to-beta Performance or correctness regression from stable to beta. T-compiler Relevant to the compiler team, which will review and decide on the PR/issue. labels Feb 6, 2020
@pnkfelix
Copy link
Member

pnkfelix commented Feb 6, 2020

triage : P-medium, removing nomination, adding needs-bisect.

@pnkfelix pnkfelix added E-needs-bisection Call for participation: This issue needs bisection: https://github.com/rust-lang/cargo-bisect-rustc P-medium Medium priority labels Feb 6, 2020
@pnkfelix
Copy link
Member

pnkfelix commented Feb 6, 2020

(the bisection here would be entirely automatable if rust-lang/cargo-bisect-rustc#34 were addressed.)

@JohnTitor
Copy link
Member

Bisected roughly: ICE occurred from #67505 but not panicked, panicked from #68034

@rust-lang-glacier-bot rust-lang-glacier-bot added the glacier ICE tracked in rust-lang/glacier. label Feb 7, 2020
@dwrensha
Copy link
Contributor Author

dwrensha commented Feb 8, 2020

#67148 in particular looks suspicious.
cc @Centril

@dwrensha
Copy link
Contributor Author

dwrensha commented Feb 9, 2020

Pre-#67148, we return early with an error here:

ts.push(self.parse_ty()?);

Post-#67148, in the corresponding code happens in a call to parse_paren_comma_sep:

let (ts, trailing) = self.parse_paren_comma_seq(|p| {
let ty = p.parse_ty()?;
trailing_plus = p.prev_token_kind == PrevTokenKind::Plus;
Ok(ty)
})?;

and the parser "recovers" from the error encountered in p.parse_ty()?, allowing this line to be reached:
self.span_bug(ty.span, "unexpected lifetime bound")
.

@dwrensha
Copy link
Contributor Author

I opened #69014, which takes the stance that span_bug() is no longer appropriate here.

It's possible that there's a better fix that changes the way parse_paren_comma_seq() works, but that would require a deeper expertise of how these things are supposed to work than I currently have.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
C-bug Category: This is a bug. E-needs-bisection Call for participation: This issue needs bisection: https://github.com/rust-lang/cargo-bisect-rustc glacier ICE tracked in rust-lang/glacier. I-ICE Issue: The compiler panicked, giving an Internal Compilation Error (ICE) ❄️ P-medium Medium priority regression-from-stable-to-beta Performance or correctness regression from stable to beta. T-compiler Relevant to the compiler team, which will review and decide on the PR/issue.
Projects
None yet
Development

Successfully merging a pull request may close this issue.

5 participants