Skip to content

internal compiler error: unexpected lifetime bound #68890

Closed

Description

@dwrensha

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.

Activity

  1. added
    C-bugCategory: This is a bug.
    I-ICEIssue: The compiler panicked, giving an Internal Compilation Error (ICE) ❄️
    T-compilerRelevant to the compiler team, which will review and decide on the PR/issue.
    on Feb 6, 2020
  2. pnkfelix commented on Feb 6, 2020

    @pnkfelix
    Contributor

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

  3. added
    E-needs-bisectionCall for participation: This issue needs bisection: https://github.com/rust-lang/cargo-bisect-rustc
    on Feb 6, 2020
  4. pnkfelix commented on Feb 6, 2020

    @pnkfelix
    Contributor

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

  5. JohnTitor commented on Feb 6, 2020

    @JohnTitor
    Member

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

  6. dwrensha commented on Feb 8, 2020

    @dwrensha
    ContributorAuthor

    #67148 in particular looks suspicious.
    cc @Centril

  7. dwrensha commented on Feb 9, 2020

    @dwrensha
    ContributorAuthor

    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")
    .

  8. dwrensha commented on Feb 10, 2020

    @dwrensha
    ContributorAuthor

    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.

  9. added a commit that references this issue on Feb 10, 2020
    119bc97
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    C-bugCategory: This is a bug.E-needs-bisectionCall for participation: This issue needs bisection: https://github.com/rust-lang/cargo-bisect-rustcI-ICEIssue: The compiler panicked, giving an Internal Compilation Error (ICE) ❄️P-mediumMedium priorityT-compilerRelevant to the compiler team, which will review and decide on the PR/issue.glacierICE tracked in rust-lang/glacier.regression-from-stable-to-betaPerformance or correctness regression from stable to beta.

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions