Skip to content

ICE: explicit panic: compiler/rustc_errors/src/diagnostic_builder.rs #95128

Closed
@matthiaskrgr

Description

@matthiaskrgr

Code

code from a former version of ./src/libarena/lib.rs

struct TypedArenaChunk<T> {
    next: Option<~TypedArenaChunk<T>>,
}

impl<T> TypedArenaChunk<T> {
    fn new() -> ~TypedArenaChunk<T> {}
}

Meta

rustc --version --verbose:

rustc 1.61.0-nightly (1bfe40d11 2022-03-18)
binary: rustc
commit-hash: 1bfe40d11c3630254504fb73eeccfca28d50df52
commit-date: 2022-03-18
host: x86_64-unknown-linux-gnu
release: 1.61.0-nightly
LLVM version: 14.0.0

Error output

error: `~` cannot be used as a unary operator
 --> lib.rs:2:18
  |
2 |     next: Option<~TypedArenaChunk<T>>,
  |                  ^ help: use `!` to perform bitwise not

error: invalid const generic expression
 --> lib.rs:2:18
  |
2 |     next: Option<~TypedArenaChunk<T>>,
  |                  ^^^^^^^^^^^^^^^^^^
  |
help: expressions must be enclosed in braces to be used as const generic arguments
  |
2 |     next: Option<{ ~TypedArenaChunk<T }>>,
  |                  +                    +

error: unmatched angle bracket
 --> lib.rs:2:37
  |
2 |     next: Option<~TypedArenaChunk<T>>,
  |                                     ^ help: remove extra angle bracket

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

thread 'rustc' panicked at 'explicit panic', compiler/rustc_errors/src/diagnostic_builder.rs:508:21
Backtrace

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

thread 'rustc' panicked at 'explicit panic', compiler/rustc_errors/src/diagnostic_builder.rs:508:21
stack backtrace:
   0:     0x7f1a0569d9dd - std::backtrace_rs::backtrace::libunwind::trace::ha0dcc0dbac37b490
                               at /rustc/1bfe40d11c3630254504fb73eeccfca28d50df52/library/std/src/../../backtrace/src/backtrace/libunwind.rs:93:5
   1:     0x7f1a0569d9dd - std::backtrace_rs::backtrace::trace_unsynchronized::hde1ae3efbda56431
                               at /rustc/1bfe40d11c3630254504fb73eeccfca28d50df52/library/std/src/../../backtrace/src/backtrace/mod.rs:66:5
   2:     0x7f1a0569d9dd - std::sys_common::backtrace::_print_fmt::h33a851e03bd0b6e4
                               at /rustc/1bfe40d11c3630254504fb73eeccfca28d50df52/library/std/src/sys_common/backtrace.rs:66:5
   3:     0x7f1a0569d9dd - <std::sys_common::backtrace::_print::DisplayBacktrace as core::fmt::Display>::fmt::hff9ff85f8279581f
                               at /rustc/1bfe40d11c3630254504fb73eeccfca28d50df52/library/std/src/sys_common/backtrace.rs:45:22
   4:     0x7f1a056f752c - core::fmt::write::h2e0e90f8a2493173
                               at /rustc/1bfe40d11c3630254504fb73eeccfca28d50df52/library/core/src/fmt/mod.rs:1190:17
   5:     0x7f1a0568ef61 - std::io::Write::write_fmt::h034fa14aa669df7f
                               at /rustc/1bfe40d11c3630254504fb73eeccfca28d50df52/library/std/src/io/mod.rs:1655:15
   6:     0x7f1a056a0ac5 - std::sys_common::backtrace::_print::h84318396c29faefb
                               at /rustc/1bfe40d11c3630254504fb73eeccfca28d50df52/library/std/src/sys_common/backtrace.rs:48:5
   7:     0x7f1a056a0ac5 - std::sys_common::backtrace::print::h9768394db98e45ff
                               at /rustc/1bfe40d11c3630254504fb73eeccfca28d50df52/library/std/src/sys_common/backtrace.rs:35:9
   8:     0x7f1a056a0ac5 - std::panicking::default_hook::{{closure}}::hce98dd26e8c80f17
                               at /rustc/1bfe40d11c3630254504fb73eeccfca28d50df52/library/std/src/panicking.rs:295:22
   9:     0x7f1a056a0779 - std::panicking::default_hook::hf647f5f3bad56e08
                               at /rustc/1bfe40d11c3630254504fb73eeccfca28d50df52/library/std/src/panicking.rs:314:9
  10:     0x7f1a05ecc271 - rustc_driver[2d9984ec3b69f6c8]::DEFAULT_HOOK::{closure#0}::{closure#0}
  11:     0x7f1a056a1210 - std::panicking::rust_panic_with_hook::he4d6049ea2de960b
                               at /rustc/1bfe40d11c3630254504fb73eeccfca28d50df52/library/std/src/panicking.rs:702:17
  12:     0x7f1a056a1009 - std::panicking::begin_panic_handler::{{closure}}::hefe48cd5b70c6c39
                               at /rustc/1bfe40d11c3630254504fb73eeccfca28d50df52/library/std/src/panicking.rs:586:13
  13:     0x7f1a0569de94 - std::sys_common::backtrace::__rust_end_short_backtrace::h925c3fef9b95b3ea
                               at /rustc/1bfe40d11c3630254504fb73eeccfca28d50df52/library/std/src/sys_common/backtrace.rs:138:18
  14:     0x7f1a056a0d79 - rust_begin_unwind
                               at /rustc/1bfe40d11c3630254504fb73eeccfca28d50df52/library/std/src/panicking.rs:584:5
  15:     0x7f1a05664c93 - core::panicking::panic_fmt::h4129b45703e57723
                               at /rustc/1bfe40d11c3630254504fb73eeccfca28d50df52/library/core/src/panicking.rs:143:14
  16:     0x7f1a05664b5d - core::panicking::panic::h6d419beb146ec935
                               at /rustc/1bfe40d11c3630254504fb73eeccfca28d50df52/library/core/src/panicking.rs:48:5
  17:     0x7f1a07cdd3ed - <rustc_errors[9a0bab4d6ac1940a]::diagnostic_builder::DiagnosticBuilderInner as core[e36ddb4c72619525]::ops::drop::Drop>::drop
  18:     0x7f1a06bdbbed - core[e36ddb4c72619525]::ptr::drop_in_place::<rustc_errors[9a0bab4d6ac1940a]::diagnostic_builder::DiagnosticBuilderInner>
  19:     0x7f1a0845cf8a - <rustc_parse[4f10fec2c3c42d5e]::parser::Parser>::parse_field_def::{closure#0}
  20:     0x7f1a08459591 - <rustc_parse[4f10fec2c3c42d5e]::parser::Parser>::parse_record_struct_body
  21:     0x7f1a079d2d71 - <rustc_parse[4f10fec2c3c42d5e]::parser::Parser>::parse_item_common
  22:     0x7f1a079d09b4 - <rustc_parse[4f10fec2c3c42d5e]::parser::Parser>::parse_mod
  23:     0x7f1a08468468 - rustc_parse[4f10fec2c3c42d5e]::parse_crate_from_file
  24:     0x7f1a07d78719 - <rustc_session[44a8dacdbda4c85a]::session::Session>::time::<core[e36ddb4c72619525]::result::Result<rustc_ast[f6a24c142fcd2ec9]::ast::Crate, rustc_errors[9a0bab4d6ac1940a]::diagnostic_builder::DiagnosticBuilder<rustc_errors[9a0bab4d6ac1940a]::ErrorGuaranteed>>, rustc_interface[261c0c4ee18c4905]::passes::parse::{closure#0}>
  25:     0x7f1a07d5cf2a - rustc_interface[261c0c4ee18c4905]::passes::parse
  26:     0x7f1a07d54996 - <rustc_interface[261c0c4ee18c4905]::queries::Queries>::parse
  27:     0x7f1a07d1a6b8 - <rustc_interface[261c0c4ee18c4905]::interface::Compiler>::enter::<rustc_driver[2d9984ec3b69f6c8]::run_compiler::{closure#1}::{closure#2}, core[e36ddb4c72619525]::result::Result<core[e36ddb4c72619525]::option::Option<rustc_interface[261c0c4ee18c4905]::queries::Linker>, rustc_errors[9a0bab4d6ac1940a]::ErrorGuaranteed>>
  28:     0x7f1a07d2d91f - rustc_span[187db9b1cfcb079d]::with_source_map::<core[e36ddb4c72619525]::result::Result<(), rustc_errors[9a0bab4d6ac1940a]::ErrorGuaranteed>, rustc_interface[261c0c4ee18c4905]::interface::create_compiler_and_run<core[e36ddb4c72619525]::result::Result<(), rustc_errors[9a0bab4d6ac1940a]::ErrorGuaranteed>, rustc_driver[2d9984ec3b69f6c8]::run_compiler::{closure#1}>::{closure#1}>
  29:     0x7f1a07d1bec4 - rustc_interface[261c0c4ee18c4905]::interface::create_compiler_and_run::<core[e36ddb4c72619525]::result::Result<(), rustc_errors[9a0bab4d6ac1940a]::ErrorGuaranteed>, rustc_driver[2d9984ec3b69f6c8]::run_compiler::{closure#1}>
  30:     0x7f1a07d18262 - <scoped_tls[8a9a8d9ce9b03694]::ScopedKey<rustc_span[187db9b1cfcb079d]::SessionGlobals>>::set::<rustc_interface[261c0c4ee18c4905]::interface::run_compiler<core[e36ddb4c72619525]::result::Result<(), rustc_errors[9a0bab4d6ac1940a]::ErrorGuaranteed>, rustc_driver[2d9984ec3b69f6c8]::run_compiler::{closure#1}>::{closure#0}, core[e36ddb4c72619525]::result::Result<(), rustc_errors[9a0bab4d6ac1940a]::ErrorGuaranteed>>
  31:     0x7f1a07d166ff - std[1999d1a60a4290e6]::sys_common::backtrace::__rust_begin_short_backtrace::<rustc_interface[261c0c4ee18c4905]::util::run_in_thread_pool_with_globals<rustc_interface[261c0c4ee18c4905]::interface::run_compiler<core[e36ddb4c72619525]::result::Result<(), rustc_errors[9a0bab4d6ac1940a]::ErrorGuaranteed>, rustc_driver[2d9984ec3b69f6c8]::run_compiler::{closure#1}>::{closure#0}, core[e36ddb4c72619525]::result::Result<(), rustc_errors[9a0bab4d6ac1940a]::ErrorGuaranteed>>::{closure#0}, core[e36ddb4c72619525]::result::Result<(), rustc_errors[9a0bab4d6ac1940a]::ErrorGuaranteed>>
  32:     0x7f1a07d2e8a2 - <<std[1999d1a60a4290e6]::thread::Builder>::spawn_unchecked_<rustc_interface[261c0c4ee18c4905]::util::run_in_thread_pool_with_globals<rustc_interface[261c0c4ee18c4905]::interface::run_compiler<core[e36ddb4c72619525]::result::Result<(), rustc_errors[9a0bab4d6ac1940a]::ErrorGuaranteed>, rustc_driver[2d9984ec3b69f6c8]::run_compiler::{closure#1}>::{closure#0}, core[e36ddb4c72619525]::result::Result<(), rustc_errors[9a0bab4d6ac1940a]::ErrorGuaranteed>>::{closure#0}, core[e36ddb4c72619525]::result::Result<(), rustc_errors[9a0bab4d6ac1940a]::ErrorGuaranteed>>::{closure#1} as core[e36ddb4c72619525]::ops::function::FnOnce<()>>::call_once::{shim:vtable#0}
  33:     0x7f1a056ab3a3 - <alloc::boxed::Box<F,A> as core::ops::function::FnOnce<Args>>::call_once::hcb71f654c0b0fdfd
                               at /rustc/1bfe40d11c3630254504fb73eeccfca28d50df52/library/alloc/src/boxed.rs:1853:9
  34:     0x7f1a056ab3a3 - <alloc::boxed::Box<F,A> as core::ops::function::FnOnce<Args>>::call_once::h064662d2acfead96
                               at /rustc/1bfe40d11c3630254504fb73eeccfca28d50df52/library/alloc/src/boxed.rs:1853:9
  35:     0x7f1a056ab3a3 - std::sys::unix::thread::Thread::new::thread_start::hebe5500058936555
                               at /rustc/1bfe40d11c3630254504fb73eeccfca28d50df52/library/std/src/sys/unix/thread.rs:108:17
  36:     0x7f1a054835c2 - start_thread
  37:     0x7f1a05508584 - __clone
  38:                0x0 - <unknown>

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.61.0-nightly (1bfe40d11 2022-03-18) running on x86_64-unknown-linux-gnu

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

Metadata

Metadata

Assignees

Labels

A-diagnosticsArea: Messages for errors, warnings, and lintsC-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.

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions