Skip to content

ICE: error was constructed but not emitted #122112

Closed
@matthiaskrgr

Description

@matthiaskrgr

auto-reduced (treereduce-rust):

fn main() {
    let _: std::env::temp_dir().join(&self, push: Box<>); 
}

original:

fn main() {
    let _: std::env::temp_dir().join(&self, push: Box<dyn FnMut() + 'f>); //~ ERROR expected one of
}

Version information

rustc 1.78.0-nightly (bfe762e0e 2024-03-06)
binary: rustc
commit-hash: bfe762e0ed2e95041cc12c02c5565c4368f2cc9f
commit-date: 2024-03-06
host: x86_64-unknown-linux-gnu
release: 1.78.0-nightly
LLVM version: 18.1.0

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

Program output

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

error: expected identifier, found `:`
 --> /tmp/icemaker_global_tempdir.Yf72Q4K8Uuvx/rustc_testrunner_tmpdir_reporting.9JIajiTiHyaS/mvce.rs:2:49
  |
2 |     let _: std::env::temp_dir().join(&self, push: Box<>); 
  |                                                 ^ expected identifier

thread 'rustc' panicked at /rustc/bfe762e0ed2e95041cc12c02c5565c4368f2cc9f/compiler/rustc_errors/src/diagnostic.rs:1343:17:
error was constructed but not emitted
stack backtrace:
   0:     0x7f6898f8c744 - std::backtrace_rs::backtrace::libunwind::trace::h9cc6e275ed2ae01d
                               at /rustc/bfe762e0ed2e95041cc12c02c5565c4368f2cc9f/library/std/src/../../backtrace/src/backtrace/libunwind.rs:104:5
   1:     0x7f6898f8c744 - std::backtrace_rs::backtrace::trace_unsynchronized::h5d01daa7b6fa772f
                               at /rustc/bfe762e0ed2e95041cc12c02c5565c4368f2cc9f/library/std/src/../../backtrace/src/backtrace/mod.rs:66:5
   2:     0x7f6898f8c744 - std::sys_common::backtrace::_print_fmt::haaccd504ba9091ef
                               at /rustc/bfe762e0ed2e95041cc12c02c5565c4368f2cc9f/library/std/src/sys_common/backtrace.rs:68:5
   3:     0x7f6898f8c744 - <std::sys_common::backtrace::_print::DisplayBacktrace as core::fmt::Display>::fmt::h210b1832d9b860ac
                               at /rustc/bfe762e0ed2e95041cc12c02c5565c4368f2cc9f/library/std/src/sys_common/backtrace.rs:44:22
   4:     0x7f6898fdda7c - core::fmt::rt::Argument::fmt::hf4c6ceedf597f216
                               at /rustc/bfe762e0ed2e95041cc12c02c5565c4368f2cc9f/library/core/src/fmt/rt.rs:142:9
   5:     0x7f6898fdda7c - core::fmt::write_internal::hb28fa27cffed1c92
                               at /rustc/bfe762e0ed2e95041cc12c02c5565c4368f2cc9f/library/core/src/fmt/mod.rs:1143:17
   6:     0x7f6898f81047 - core::fmt::write::ha6d543e04c076037
                               at /rustc/bfe762e0ed2e95041cc12c02c5565c4368f2cc9f/library/core/src/fmt/mod.rs:1125:67
   7:     0x7f6898f81047 - std::io::Write::write_fmt::h19ca466dd0ea40f6
                               at /rustc/bfe762e0ed2e95041cc12c02c5565c4368f2cc9f/library/std/src/io/mod.rs:1846:15
   8:     0x7f6898f8c4f4 - std::sys_common::backtrace::_print::h6908b4e1df1a11be
                               at /rustc/bfe762e0ed2e95041cc12c02c5565c4368f2cc9f/library/std/src/sys_common/backtrace.rs:47:5
   9:     0x7f6898f8c4f4 - std::sys_common::backtrace::print::hb41ad145a3c8331c
                               at /rustc/bfe762e0ed2e95041cc12c02c5565c4368f2cc9f/library/std/src/sys_common/backtrace.rs:34:9
  10:     0x7f6898f8f0fb - std::panicking::default_hook::{{closure}}::h4d93eafeed866f04
  11:     0x7f6898f8ee57 - std::panicking::default_hook::h911396b219393e29
                               at /rustc/bfe762e0ed2e95041cc12c02c5565c4368f2cc9f/library/std/src/panicking.rs:292:9
  12:     0x7f689be8861c - std[3e30442d1aba6efe]::panicking::update_hook::<alloc[16d7cc569c5579ac]::boxed::Box<rustc_driver_impl[aaeed28a45c515a]::install_ice_hook::{closure#0}>>::{closure#0}
  13:     0x7f6898f8f812 - <alloc::boxed::Box<F,A> as core::ops::function::Fn<Args>>::call::h1d263bab631c01b0
                               at /rustc/bfe762e0ed2e95041cc12c02c5565c4368f2cc9f/library/alloc/src/boxed.rs:2030:9
  14:     0x7f6898f8f812 - std::panicking::rust_panic_with_hook::h87ec5f2ad47834a3
                               at /rustc/bfe762e0ed2e95041cc12c02c5565c4368f2cc9f/library/std/src/panicking.rs:783:13
  15:     0x7f6898f8f599 - std::panicking::begin_panic_handler::{{closure}}::hf4141656606fed52
                               at /rustc/bfe762e0ed2e95041cc12c02c5565c4368f2cc9f/library/std/src/panicking.rs:649:13
  16:     0x7f6898f8cc16 - std::sys_common::backtrace::__rust_end_short_backtrace::hbbd40cc7911b3b1f
                               at /rustc/bfe762e0ed2e95041cc12c02c5565c4368f2cc9f/library/std/src/sys_common/backtrace.rs:171:18
  17:     0x7f6898f8f2d4 - rust_begin_unwind
                               at /rustc/bfe762e0ed2e95041cc12c02c5565c4368f2cc9f/library/std/src/panicking.rs:645:5
  18:     0x7f6898fd9cd5 - core::panicking::panic_fmt::hc02c3fcc585e1277
                               at /rustc/bfe762e0ed2e95041cc12c02c5565c4368f2cc9f/library/core/src/panicking.rs:72:14
  19:     0x7f689ae88b61 - core[67ed04b9f8898570]::ptr::drop_in_place::<rustc_errors[844a3ff84fb6c0c1]::diagnostic::Diag>
  20:     0x7f689d916395 - <rustc_parse[20b33016db920a2f]::parser::Parser>::parse_block_tail
  21:     0x7f689d87ecb4 - <rustc_parse[20b33016db920a2f]::parser::Parser>::parse_fn
  22:     0x7f689db84cd7 - <rustc_parse[20b33016db920a2f]::parser::Parser>::parse_item_kind
  23:     0x7f689d73fe0d - <rustc_parse[20b33016db920a2f]::parser::Parser>::parse_item_common
  24:     0x7f689d73d863 - <rustc_parse[20b33016db920a2f]::parser::Parser>::parse_mod
  25:     0x7f689dee9ad8 - rustc_interface[9b50768a85848783]::passes::parse
  26:     0x7f689dee98d3 - <rustc_interface[9b50768a85848783]::queries::Queries>::parse
  27:     0x7f689df28119 - rustc_interface[9b50768a85848783]::interface::run_compiler::<core[67ed04b9f8898570]::result::Result<(), rustc_span[39255c05d445cf6e]::ErrorGuaranteed>, rustc_driver_impl[aaeed28a45c515a]::run_compiler::{closure#0}>::{closure#0}
  28:     0x7f689e1f3505 - std[3e30442d1aba6efe]::sys_common::backtrace::__rust_begin_short_backtrace::<rustc_interface[9b50768a85848783]::util::run_in_thread_with_globals<rustc_interface[9b50768a85848783]::util::run_in_thread_pool_with_globals<rustc_interface[9b50768a85848783]::interface::run_compiler<core[67ed04b9f8898570]::result::Result<(), rustc_span[39255c05d445cf6e]::ErrorGuaranteed>, rustc_driver_impl[aaeed28a45c515a]::run_compiler::{closure#0}>::{closure#0}, core[67ed04b9f8898570]::result::Result<(), rustc_span[39255c05d445cf6e]::ErrorGuaranteed>>::{closure#0}, core[67ed04b9f8898570]::result::Result<(), rustc_span[39255c05d445cf6e]::ErrorGuaranteed>>::{closure#0}::{closure#0}, core[67ed04b9f8898570]::result::Result<(), rustc_span[39255c05d445cf6e]::ErrorGuaranteed>>
  29:     0x7f689e1f3332 - <<std[3e30442d1aba6efe]::thread::Builder>::spawn_unchecked_<rustc_interface[9b50768a85848783]::util::run_in_thread_with_globals<rustc_interface[9b50768a85848783]::util::run_in_thread_pool_with_globals<rustc_interface[9b50768a85848783]::interface::run_compiler<core[67ed04b9f8898570]::result::Result<(), rustc_span[39255c05d445cf6e]::ErrorGuaranteed>, rustc_driver_impl[aaeed28a45c515a]::run_compiler::{closure#0}>::{closure#0}, core[67ed04b9f8898570]::result::Result<(), rustc_span[39255c05d445cf6e]::ErrorGuaranteed>>::{closure#0}, core[67ed04b9f8898570]::result::Result<(), rustc_span[39255c05d445cf6e]::ErrorGuaranteed>>::{closure#0}::{closure#0}, core[67ed04b9f8898570]::result::Result<(), rustc_span[39255c05d445cf6e]::ErrorGuaranteed>>::{closure#1} as core[67ed04b9f8898570]::ops::function::FnOnce<()>>::call_once::{shim:vtable#0}
  30:     0x7f6898f98f75 - <alloc::boxed::Box<F,A> as core::ops::function::FnOnce<Args>>::call_once::h7dde4080b7bb8b8f
                               at /rustc/bfe762e0ed2e95041cc12c02c5565c4368f2cc9f/library/alloc/src/boxed.rs:2016:9
  31:     0x7f6898f98f75 - <alloc::boxed::Box<F,A> as core::ops::function::FnOnce<Args>>::call_once::hb3f078d05a809ba8
                               at /rustc/bfe762e0ed2e95041cc12c02c5565c4368f2cc9f/library/alloc/src/boxed.rs:2016:9
  32:     0x7f6898f98f75 - std::sys::pal::unix::thread::Thread::new::thread_start::hbaa74abe0ee6f379
                               at /rustc/bfe762e0ed2e95041cc12c02c5565c4368f2cc9f/library/std/src/sys/pal/unix/thread.rs:108:17
  33:     0x7f6898d8055a - <unknown>
  34:     0x7f6898dfda3c - <unknown>
  35:                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.78.0-nightly (bfe762e0e 2024-03-06) 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

No one assigned

    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