rust-lang/rust

internal compiler error: the following error was constructed but not emitted

dwrensha opened this issue · 3 comments

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

const pub () {}
pub fn main() {}
$ rustc bug.rs
error: internal compiler error: the following error was constructed but not emitted

error: expected one of `async`, `extern`, `fn`, or `unsafe`, found keyword `pub`
 --> bug.rs:1:7
  |
1 | const pub () {}
  |       ^^^ expected one of `async`, `extern`, `fn`, or `unsafe`

thread 'rustc' panicked at 'explicit panic', compiler/rustc_errors/src/diagnostic_builder.rs:424:13
note: run with `RUST_BACKTRACE=1` environment variable to display a backtrace

error: internal compiler error: unexpected panic

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

note: we would appreciate a bug report: https://github.com/rust-lang/rust/issues/new?labels=C-bug%2C+I-ICE%2C+T-compiler&template=ice.md

note: rustc 1.55.0-nightly (b3d11f95c 2021-07-04) running on x86_64-unknown-linux-gnu

query stack during panic:
end of query stack
error: aborting due to 2 previous errors

searched nightlies: from nightly-2021-02-10 to nightly-2021-05-01
regressed nightly: nightly-2021-03-19
searched commits: from 36f1f04 to 1705a7d
regressed commit: 81c1d7a

bisected with cargo-bisect-rustc v0.6.0

Host triple: x86_64-unknown-linux-gnu
Reproduce with:

cargo bisect-rustc --start=2021-2-10 --end=2021-05-01 --regress ice 

It looks like #76447 is when this error started happening. cc @pickfire

rylev commented

I'm going to take a look at this.

@rustbot claim

Assigning priority as discussed in the Zulip thread of the Prioritization Working Group.

@rustbot label -I-prioritize +P-low