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: the following error was constructed but not emitted #86895

Closed
dwrensha opened this issue Jul 5, 2021 · 3 comments · Fixed by #86932
Closed

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

dwrensha opened this issue Jul 5, 2021 · 3 comments · Fixed by #86932
Assignees
Labels
A-parser Area: The parsing of Rust source code to an AST C-bug Category: This is a bug. I-ICE Issue: The compiler panicked, giving an Internal Compilation Error (ICE) ❄️ P-low Low priority T-compiler Relevant to the compiler team, which will review and decide on the PR/issue.

Comments

@dwrensha
Copy link
Contributor

dwrensha commented Jul 5, 2021

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
@dwrensha dwrensha added C-bug Category: This is a bug. I-ICE Issue: The compiler panicked, giving an Internal Compilation Error (ICE) ❄️ T-compiler Relevant to the compiler team, which will review and decide on the PR/issue. labels Jul 5, 2021
@dwrensha
Copy link
Contributor Author

dwrensha commented Jul 5, 2021

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

@jonas-schievink jonas-schievink added A-parser Area: The parsing of Rust source code to an AST I-prioritize Issue: Indicates that prioritization has been requested for this issue. labels Jul 5, 2021
@rylev
Copy link
Member

rylev commented Jul 7, 2021

I'm going to take a look at this.

@rustbot claim

@apiraino
Copy link
Contributor

apiraino commented Jul 7, 2021

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

@rustbot label -I-prioritize +P-low

@rustbot rustbot added P-low Low priority and removed I-prioritize Issue: Indicates that prioritization has been requested for this issue. labels Jul 7, 2021
JohnTitor added a commit to JohnTitor/rust that referenced this issue Jul 7, 2021
Fix ICE when misplaced visibility cannot be properly parsed

Fixes rust-lang#86895

The issue was that a failure to parse the visibility was causing the original error to be dropped before being emitted.

The resulting error isn't quite as nice as when the visibility is parsed properly, but I'm not sure which error to prioritize here. Displaying both errors might be too confusing.

r? `@estebank`
JohnTitor added a commit to JohnTitor/rust that referenced this issue Jul 7, 2021
Fix ICE when misplaced visibility cannot be properly parsed

Fixes rust-lang#86895

The issue was that a failure to parse the visibility was causing the original error to be dropped before being emitted.

The resulting error isn't quite as nice as when the visibility is parsed properly, but I'm not sure which error to prioritize here. Displaying both errors might be too confusing.

r? ``@estebank``
@bors bors closed this as completed in 463301a Jul 8, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
A-parser Area: The parsing of Rust source code to an AST C-bug Category: This is a bug. I-ICE Issue: The compiler panicked, giving an Internal Compilation Error (ICE) ❄️ P-low Low priority 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