Closed
Description
Code
trait t { const
impl
md5 of poc.rs: 7593012a00629a632a7b06982cbccb2f
The bug can be reproduced via rustc poc.rs
Meta
The bug is reproduced with nightly and beta versions, but not with stable version.
rustc --version --verbose
:
rustc 1.51.0-nightly (4f4656d46 2021-02-04)
binary: rustc
commit-hash: 4f4656d46d84a488ae3df34b08f362d7071036a0
commit-date: 2021-02-04
host: x86_64-unknown-linux-gnu
release: 1.51.0-nightly
LLVM version: 11.0.1
rustc 1.50.0-beta.8 (1cd030396 2021-01-20)
binary: rustc
commit-hash: 1cd0303963629f317a08e7e52162ccca7232ae7f
commit-date: 2021-01-20
host: x86_64-unknown-linux-gnu
release: 1.50.0-beta.8
Error output
The output is from nightly version.
➜ playground rustc poc.rs
error: this file contains an unclosed delimiter
--> out.rs:2:6
|
1 | trait t { const
| - unclosed delimiter
2 | impl
| ^
error: internal compiler error: the following error was constructed but not emitted
error: expected identifier, found keyword `impl`
--> out.rs:2:1
|
2 | impl
| ^^^^ expected identifier, found keyword
|
help: you can escape reserved keywords to use them as identifiers
|
2 | r#impl
|
thread 'rustc' panicked at 'explicit panic', compiler/rustc_errors/src/diagnostic_builder.rs:460: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.51.0-nightly (4f4656d46 2021-02-04) running on x86_64-unknown-linux-gnu
query stack during panic:
end of query stack
error: aborting due to 3 previous errors
Backtrace
➜ playground RURUST_BACKTRACE=1 rustc poc.rs
error: this file contains an unclosed delimiter
--> out.rs:2:6
|
1 | trait t { const
| - unclosed delimiter
2 | impl
| ^
error: internal compiler error: the following error was constructed but not emitted
error: expected identifier, found keyword `impl`
--> out.rs:2:1
|
2 | impl
| ^^^^ expected identifier, found keyword
|
help: you can escape reserved keywords to use them as identifiers
|
2 | r#impl
|
thread 'rustc' panicked at 'explicit panic', compiler/rustc_errors/src/diagnostic_builder.rs:460:13
stack backtrace:
0: std::panicking::begin_panic
1: <rustc_errors::diagnostic_builder::DiagnosticBuilder as core::ops::drop::Drop>::drop
2: rustc_parse::parser::item::<impl rustc_parse::parser::Parser>::recover_const_impl
3: rustc_parse::parser::item::<impl rustc_parse::parser::Parser>::parse_item_common_
4: rustc_parse::parser::item::<impl rustc_parse::parser::Parser>::parse_item_common
5: rustc_parse::parser::item::<impl rustc_parse::parser::Parser>::parse_assoc_item
6: rustc_parse::parser::item::<impl rustc_parse::parser::Parser>::parse_item_common_
7: rustc_parse::parser::item::<impl rustc_parse::parser::Parser>::parse_item_common
8: rustc_parse::parser::item::<impl rustc_parse::parser::Parser>::parse_mod
9: rustc_parse::parse_crate_from_file
10: rustc_session::utils::<impl rustc_session::session::Session>::time
11: rustc_interface::passes::parse
12: rustc_interface::queries::Queries::parse
13: rustc_interface::queries::<impl rustc_interface::interface::Compiler>::enter
14: rustc_span::with_source_map
15: rustc_interface::interface::create_compiler_and_run
16: rustc_span::with_session_globals
note: Some details are omitted, run with `RUST_BACKTRACE=full` for a verbose 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.51.0-nightly (4f4656d46 2021-02-04) running on x86_64-unknown-linux-gnu
query stack during panic:
end of query stack
error: aborting due to 3 previous errors
Metadata
Metadata
Assignees
Labels
Area: Messages for errors, warnings, and lintsArea: The lexing & parsing of Rust source code to an ASTCategory: This is a bug.Issue: The compiler panicked, giving an Internal Compilation Error (ICE) ❄️Medium priorityRelevant to the compiler team, which will review and decide on the PR/issue.ICE tracked in rust-lang/glacier.