Skip to content

ICE: the following error was constructed but not emitted #118164

Closed
@matthiaskrgr

Description

@matthiaskrgr

snippet:

fn bar() -> String {
    #[cfg(feature = )]
    [1, 2, 3].iter().map().collect::<String>() 
    #[attr]    
}

Version information

rustc 1.76.0-nightly (fec80b447 2023-11-21)
binary: rustc
commit-hash: fec80b4475c871ad3e4d70d29d1781ee771fe631
commit-date: 2023-11-21
host: x86_64-unknown-linux-gnu
release: 1.76.0-nightly
LLVM version: 17.0.5

Command:
/home/matthias/.rustup/toolchains/master/bin/rustc

Program output

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

error: expected expression, found `}`
 --> /tmp/icemaker_global_tempdir.UPwrp0vkbZg9/rustc_testrunner_tmpdir_reporting.tTQzfYW6qnY4/mvce.rs:5:1
  |
5 | }
  | ^ expected expression

thread 'rustc' panicked at compiler/rustc_errors/src/diagnostic_builder.rs:776:21:
error was constructed but not emitted
stack backtrace:
   0:     0x7f2b8c7dcafc - std::backtrace_rs::backtrace::libunwind::trace::h96b16453198fbb62
                               at /rustc/fec80b4475c871ad3e4d70d29d1781ee771fe631/library/std/src/../../backtrace/src/backtrace/libunwind.rs:104:5
   1:     0x7f2b8c7dcafc - std::backtrace_rs::backtrace::trace_unsynchronized::hc56b894c61e1807b
                               at /rustc/fec80b4475c871ad3e4d70d29d1781ee771fe631/library/std/src/../../backtrace/src/backtrace/mod.rs:66:5
   2:     0x7f2b8c7dcafc - std::sys_common::backtrace::_print_fmt::h73f0b916e316d7f2
                               at /rustc/fec80b4475c871ad3e4d70d29d1781ee771fe631/library/std/src/sys_common/backtrace.rs:68:5
   3:     0x7f2b8c7dcafc - <std::sys_common::backtrace::_print::DisplayBacktrace as core::fmt::Display>::fmt::h3778de479f43f3b9
                               at /rustc/fec80b4475c871ad3e4d70d29d1781ee771fe631/library/std/src/sys_common/backtrace.rs:44:22
   4:     0x7f2b8c82fc80 - core::fmt::rt::Argument::fmt::ha6fe89fede47cad4
                               at /rustc/fec80b4475c871ad3e4d70d29d1781ee771fe631/library/core/src/fmt/rt.rs:142:9
   5:     0x7f2b8c82fc80 - core::fmt::write::hb606b88f4e1d28cf
                               at /rustc/fec80b4475c871ad3e4d70d29d1781ee771fe631/library/core/src/fmt/mod.rs:1120:17
   6:     0x7f2b8c7d09af - std::io::Write::write_fmt::h48fea01dbf6745f5
                               at /rustc/fec80b4475c871ad3e4d70d29d1781ee771fe631/library/std/src/io/mod.rs:1762:15
   7:     0x7f2b8c7dc8e4 - std::sys_common::backtrace::_print::h3c16a46dccc06f9c
                               at /rustc/fec80b4475c871ad3e4d70d29d1781ee771fe631/library/std/src/sys_common/backtrace.rs:47:5
   8:     0x7f2b8c7dc8e4 - std::sys_common::backtrace::print::h32043e7308f1fb89
                               at /rustc/fec80b4475c871ad3e4d70d29d1781ee771fe631/library/std/src/sys_common/backtrace.rs:34:9
   9:     0x7f2b8c7df577 - std::panicking::default_hook::{{closure}}::h37f83641e07260d5
  10:     0x7f2b8c7df2df - std::panicking::default_hook::hef1de3942981e4d6
                               at /rustc/fec80b4475c871ad3e4d70d29d1781ee771fe631/library/std/src/panicking.rs:292:9
  11:     0x7f2b894f1790 - std[25ee9ea4cf591f91]::panicking::update_hook::<alloc[4ca211c96737eeee]::boxed::Box<rustc_driver_impl[aeb365f712975100]::install_ice_hook::{closure#0}>>::{closure#0}
  12:     0x7f2b8c7dfcb8 - <alloc::boxed::Box<F,A> as core::ops::function::Fn<Args>>::call::h9a7d88e7b7066f69
                               at /rustc/fec80b4475c871ad3e4d70d29d1781ee771fe631/library/alloc/src/boxed.rs:2021:9
  13:     0x7f2b8c7dfcb8 - std::panicking::rust_panic_with_hook::hb43b782da8bd094e
                               at /rustc/fec80b4475c871ad3e4d70d29d1781ee771fe631/library/std/src/panicking.rs:783:13
  14:     0x7f2b8c7df9d9 - std::panicking::begin_panic_handler::{{closure}}::h8c00fe18b878e8ac
                               at /rustc/fec80b4475c871ad3e4d70d29d1781ee771fe631/library/std/src/panicking.rs:649:13
  15:     0x7f2b8c7dcfc6 - std::sys_common::backtrace::__rust_end_short_backtrace::h41290e67e80fb104
                               at /rustc/fec80b4475c871ad3e4d70d29d1781ee771fe631/library/std/src/sys_common/backtrace.rs:171:18
  16:     0x7f2b8c7df772 - rust_begin_unwind
                               at /rustc/fec80b4475c871ad3e4d70d29d1781ee771fe631/library/std/src/panicking.rs:645:5
  17:     0x7f2b8c82c365 - core::panicking::panic_fmt::h6a8caa214b341e91
                               at /rustc/fec80b4475c871ad3e4d70d29d1781ee771fe631/library/core/src/panicking.rs:72:14
  18:     0x7f2b8ae9f855 - <rustc_errors[cac49771d7b27ae0]::diagnostic_builder::DiagnosticBuilderInner as core[e87d9b99a614643c]::ops::drop::Drop>::drop
  19:     0x7f2b8ae9f894 - core[e87d9b99a614643c]::ptr::drop_in_place::<rustc_errors[cac49771d7b27ae0]::diagnostic_builder::DiagnosticBuilderInner>
  20:     0x7f2b88269249 - <rustc_parse[5f3dd73e9de6daf8]::parser::Parser>::attr_on_non_tail_expr
  21:     0x7f2b8af3931b - <rustc_parse[5f3dd73e9de6daf8]::parser::Parser>::parse_block_tail
  22:     0x7f2b8ae9581f - <rustc_parse[5f3dd73e9de6daf8]::parser::Parser>::parse_fn
  23:     0x7f2b8af493f8 - <rustc_parse[5f3dd73e9de6daf8]::parser::Parser>::parse_item_kind
  24:     0x7f2b8abec051 - <rustc_parse[5f3dd73e9de6daf8]::parser::Parser>::parse_item_common
  25:     0x7f2b8abe93ad - <rustc_parse[5f3dd73e9de6daf8]::parser::Parser>::parse_mod
  26:     0x7f2b8b567ed0 - rustc_interface[139416c1630c812c]::passes::parse
  27:     0x7f2b8b567c4e - <rustc_interface[139416c1630c812c]::queries::Queries>::parse
  28:     0x7f2b8b815fdd - rustc_interface[139416c1630c812c]::interface::run_compiler::<core[e87d9b99a614643c]::result::Result<(), rustc_span[1af8165c9baf8c46]::ErrorGuaranteed>, rustc_driver_impl[aeb365f712975100]::run_compiler::{closure#0}>::{closure#0}
  29:     0x7f2b8b7a5fd4 - std[25ee9ea4cf591f91]::sys_common::backtrace::__rust_begin_short_backtrace::<rustc_interface[139416c1630c812c]::util::run_in_thread_with_globals<rustc_interface[139416c1630c812c]::util::run_in_thread_pool_with_globals<rustc_interface[139416c1630c812c]::interface::run_compiler<core[e87d9b99a614643c]::result::Result<(), rustc_span[1af8165c9baf8c46]::ErrorGuaranteed>, rustc_driver_impl[aeb365f712975100]::run_compiler::{closure#0}>::{closure#0}, core[e87d9b99a614643c]::result::Result<(), rustc_span[1af8165c9baf8c46]::ErrorGuaranteed>>::{closure#0}, core[e87d9b99a614643c]::result::Result<(), rustc_span[1af8165c9baf8c46]::ErrorGuaranteed>>::{closure#0}::{closure#0}, core[e87d9b99a614643c]::result::Result<(), rustc_span[1af8165c9baf8c46]::ErrorGuaranteed>>
  30:     0x7f2b8b7a5dfd - <<std[25ee9ea4cf591f91]::thread::Builder>::spawn_unchecked_<rustc_interface[139416c1630c812c]::util::run_in_thread_with_globals<rustc_interface[139416c1630c812c]::util::run_in_thread_pool_with_globals<rustc_interface[139416c1630c812c]::interface::run_compiler<core[e87d9b99a614643c]::result::Result<(), rustc_span[1af8165c9baf8c46]::ErrorGuaranteed>, rustc_driver_impl[aeb365f712975100]::run_compiler::{closure#0}>::{closure#0}, core[e87d9b99a614643c]::result::Result<(), rustc_span[1af8165c9baf8c46]::ErrorGuaranteed>>::{closure#0}, core[e87d9b99a614643c]::result::Result<(), rustc_span[1af8165c9baf8c46]::ErrorGuaranteed>>::{closure#0}::{closure#0}, core[e87d9b99a614643c]::result::Result<(), rustc_span[1af8165c9baf8c46]::ErrorGuaranteed>>::{closure#1} as core[e87d9b99a614643c]::ops::function::FnOnce<()>>::call_once::{shim:vtable#0}
  31:     0x7f2b8c7e9b75 - <alloc::boxed::Box<F,A> as core::ops::function::FnOnce<Args>>::call_once::h190fbc5196ee75af
                               at /rustc/fec80b4475c871ad3e4d70d29d1781ee771fe631/library/alloc/src/boxed.rs:2007:9
  32:     0x7f2b8c7e9b75 - <alloc::boxed::Box<F,A> as core::ops::function::FnOnce<Args>>::call_once::h30f996fe36fb3712
                               at /rustc/fec80b4475c871ad3e4d70d29d1781ee771fe631/library/alloc/src/boxed.rs:2007:9
  33:     0x7f2b8c7e9b75 - std::sys::unix::thread::Thread::new::thread_start::h9437103b9414df7c
                               at /rustc/fec80b4475c871ad3e4d70d29d1781ee771fe631/library/std/src/sys/unix/thread.rs:108:17
  34:     0x7f2b866aa9eb - <unknown>
  35:     0x7f2b8672e7cc - <unknown>
  36:                0x0 - <unknown>

error: 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.76.0-nightly (fec80b447 2023-11-21) running on x86_64-unknown-linux-gnu

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


Metadata

Metadata

Assignees

Labels

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.

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions