Skip to content

ICE; no def-id for fresh lifetime #121431

Closed
Closed
@matthiaskrgr

Description

@matthiaskrgr

auto-reduced (treereduce-rust):

fn bug<T>() -> impl CallbackMarker<
    Item = [(); {
               |_: &mut ()| x;
               4
           }],
> {
}

original:

//@ run-pass
#![allow(unused_must_use)]
fn bug<T>() -> impl CallbackMarker<Item = [(); { |_: &mut ()| { x }; 4 }]> {
    std::iter::read()
}

fn ok<T>() -> Box<dyn Iterator<Item = [i32; 3]>> {
    Box::new(std::iter::empty())
}

fn main() {
    for _item in ok::<u32>() {}
    for _item in bug::<u128>() {}
}

Version information

rustc 1.78.0-nightly (f8131a48a 2024-02-21)
binary: rustc
commit-hash: f8131a48a46ac3bc8a3d0fe0477055b132cffdc3
commit-date: 2024-02-21
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[E0405]: cannot find trait `CallbackMarker` in this scope
 --> /tmp/icemaker_global_tempdir.pTlzvqm841Iu/rustc_testrunner_tmpdir_reporting.DgLYAgUyjwbU/mvce.rs:1:21
  |
1 | fn bug<T>() -> impl CallbackMarker<
  |                     ^^^^^^^^^^^^^^ not found in this scope

error[E0425]: cannot find value `x` in this scope
 --> /tmp/icemaker_global_tempdir.pTlzvqm841Iu/rustc_testrunner_tmpdir_reporting.DgLYAgUyjwbU/mvce.rs:3:29
  |
3 |                |_: &mut ()| x;
  |                             ^ not found in this scope

error: internal compiler error: no def-id for fresh lifetime
 --> /tmp/icemaker_global_tempdir.pTlzvqm841Iu/rustc_testrunner_tmpdir_reporting.DgLYAgUyjwbU/mvce.rs:3:20
  |
3 |                |_: &mut ()| x;
  |                    ^^^^^^^

thread 'rustc' panicked at compiler/rustc_ast_lowering/src/lib.rs:1639:36:
Box<dyn Any>
stack backtrace:
   0:     0x7f6068d8caf6 - std::backtrace_rs::backtrace::libunwind::trace::hbec2edc838b433e2
                               at /rustc/f8131a48a46ac3bc8a3d0fe0477055b132cffdc3/library/std/src/../../backtrace/src/backtrace/libunwind.rs:104:5
   1:     0x7f6068d8caf6 - std::backtrace_rs::backtrace::trace_unsynchronized::h88c30257ee0dd166
                               at /rustc/f8131a48a46ac3bc8a3d0fe0477055b132cffdc3/library/std/src/../../backtrace/src/backtrace/mod.rs:66:5
   2:     0x7f6068d8caf6 - std::sys_common::backtrace::_print_fmt::h9176654d509e3088
                               at /rustc/f8131a48a46ac3bc8a3d0fe0477055b132cffdc3/library/std/src/sys_common/backtrace.rs:68:5
   3:     0x7f6068d8caf6 - <std::sys_common::backtrace::_print::DisplayBacktrace as core::fmt::Display>::fmt::h671feaee1776bf19
                               at /rustc/f8131a48a46ac3bc8a3d0fe0477055b132cffdc3/library/std/src/sys_common/backtrace.rs:44:22
   4:     0x7f6068ddda7c - core::fmt::rt::Argument::fmt::h59605c83ae32d935
                               at /rustc/f8131a48a46ac3bc8a3d0fe0477055b132cffdc3/library/core/src/fmt/rt.rs:142:9
   5:     0x7f6068ddda7c - core::fmt::write::hf7af8dfcfd20db5b
                               at /rustc/f8131a48a46ac3bc8a3d0fe0477055b132cffdc3/library/core/src/fmt/mod.rs:1120:17
   6:     0x7f6068d814bf - std::io::Write::write_fmt::h92a5dbf489025e71
                               at /rustc/f8131a48a46ac3bc8a3d0fe0477055b132cffdc3/library/std/src/io/mod.rs:1846:15
   7:     0x7f6068d8c8a4 - std::sys_common::backtrace::_print::h00080302d23998ae
                               at /rustc/f8131a48a46ac3bc8a3d0fe0477055b132cffdc3/library/std/src/sys_common/backtrace.rs:47:5
   8:     0x7f6068d8c8a4 - std::sys_common::backtrace::print::h6b23124445400245
                               at /rustc/f8131a48a46ac3bc8a3d0fe0477055b132cffdc3/library/std/src/sys_common/backtrace.rs:34:9
   9:     0x7f6068d8f5eb - std::panicking::default_hook::{{closure}}::hd67b2f9d36675a28
  10:     0x7f6068d8f339 - std::panicking::default_hook::h10a39ef11c714e42
                               at /rustc/f8131a48a46ac3bc8a3d0fe0477055b132cffdc3/library/std/src/panicking.rs:292:9
  11:     0x7f606bc7a94c - std[5a8e7f94216a9138]::panicking::update_hook::<alloc[e14ab1f516d287ab]::boxed::Box<rustc_driver_impl[e279e4f1fedd9109]::install_ice_hook::{closure#0}>>::{closure#0}
  12:     0x7f6068d8fd50 - <alloc::boxed::Box<F,A> as core::ops::function::Fn<Args>>::call::h37ba37dc48823c1d
                               at /rustc/f8131a48a46ac3bc8a3d0fe0477055b132cffdc3/library/alloc/src/boxed.rs:2030:9
  13:     0x7f6068d8fd50 - std::panicking::rust_panic_with_hook::he3e3bc7c345bf54b
                               at /rustc/f8131a48a46ac3bc8a3d0fe0477055b132cffdc3/library/std/src/panicking.rs:786:13
  14:     0x7f606bca7524 - std[5a8e7f94216a9138]::panicking::begin_panic::<rustc_errors[34364e5c712fab73]::ExplicitBug>::{closure#0}
  15:     0x7f606bca4176 - std[5a8e7f94216a9138]::sys_common::backtrace::__rust_end_short_backtrace::<std[5a8e7f94216a9138]::panicking::begin_panic<rustc_errors[34364e5c712fab73]::ExplicitBug>::{closure#0}, !>
  16:     0x7f606bc9f936 - std[5a8e7f94216a9138]::panicking::begin_panic::<rustc_errors[34364e5c712fab73]::ExplicitBug>
  17:     0x7f606a617631 - <rustc_errors[34364e5c712fab73]::diagnostic::BugAbort as rustc_errors[34364e5c712fab73]::diagnostic::EmissionGuarantee>::emit_producing_guarantee
  18:     0x7f606dceb9b5 - <rustc_ast_lowering[6b4fd4240e533dcc]::LoweringContext>::lower_opaque_impl_trait
  19:     0x7f606d90c875 - <rustc_ast_lowering[6b4fd4240e533dcc]::LoweringContext>::lower_ty_direct
  20:     0x7f606d9087cf - <rustc_ast_lowering[6b4fd4240e533dcc]::LoweringContext>::lower_fn_decl
  21:     0x7f606dcf7244 - <rustc_ast_lowering[6b4fd4240e533dcc]::LoweringContext>::lower_item_kind
  22:     0x7f606d2d00e6 - <rustc_ast_lowering[6b4fd4240e533dcc]::item::ItemLowerer>::lower_node
  23:     0x7f606e03bec2 - rustc_ast_lowering[6b4fd4240e533dcc]::lower_to_hir
  24:     0x7f606e03b63c - rustc_query_impl[9d4c51777e2bb749]::plumbing::__rust_begin_short_backtrace::<rustc_query_impl[9d4c51777e2bb749]::query_impl::hir_crate::dynamic_query::{closure#2}::{closure#0}, rustc_middle[446dd094ad85939e]::query::erase::Erased<[u8; 8usize]>>
  25:     0x7f606dd3338e - rustc_query_system[9b2ccfe41ae3bb1b]::query::plumbing::try_execute_query::<rustc_query_impl[9d4c51777e2bb749]::DynamicConfig<rustc_query_system[9b2ccfe41ae3bb1b]::query::caches::SingleCache<rustc_middle[446dd094ad85939e]::query::erase::Erased<[u8; 8usize]>>, false, false, false>, rustc_query_impl[9d4c51777e2bb749]::plumbing::QueryCtxt, false>
  26:     0x7f606dd32ee0 - rustc_query_impl[9d4c51777e2bb749]::query_impl::hir_crate::get_query_non_incr::__rust_end_short_backtrace
  27:     0x7f606d2f7683 - rustc_query_impl[9d4c51777e2bb749]::plumbing::__rust_begin_short_backtrace::<rustc_query_impl[9d4c51777e2bb749]::query_impl::hir_attrs::dynamic_query::{closure#2}::{closure#0}, rustc_middle[446dd094ad85939e]::query::erase::Erased<[u8; 8usize]>>
  28:     0x7f606d2f6be3 - rustc_query_system[9b2ccfe41ae3bb1b]::query::plumbing::try_execute_query::<rustc_query_impl[9d4c51777e2bb749]::DynamicConfig<rustc_query_system[9b2ccfe41ae3bb1b]::query::caches::VecCache<rustc_hir[170b9793d794ea06]::hir_id::OwnerId, rustc_middle[446dd094ad85939e]::query::erase::Erased<[u8; 8usize]>>, false, false, false>, rustc_query_impl[9d4c51777e2bb749]::plumbing::QueryCtxt, false>
  29:     0x7f606d2f6949 - rustc_query_impl[9d4c51777e2bb749]::query_impl::hir_attrs::get_query_non_incr::__rust_end_short_backtrace
  30:     0x7f606d01aa2a - <rustc_middle[446dd094ad85939e]::hir::map::Map>::attrs
  31:     0x7f606e0023c3 - rustc_passes[c6f48f2d583c16f4]::entry::entry_fn
  32:     0x7f606e002358 - rustc_query_impl[9d4c51777e2bb749]::plumbing::__rust_begin_short_backtrace::<rustc_query_impl[9d4c51777e2bb749]::query_impl::entry_fn::dynamic_query::{closure#2}::{closure#0}, rustc_middle[446dd094ad85939e]::query::erase::Erased<[u8; 12usize]>>
  33:     0x7f606e002333 - <rustc_query_impl[9d4c51777e2bb749]::query_impl::entry_fn::dynamic_query::{closure#2} as core[85b4fd477ce5bb21]::ops::function::FnOnce<(rustc_middle[446dd094ad85939e]::ty::context::TyCtxt, ())>>::call_once
  34:     0x7f606e001c4a - rustc_query_system[9b2ccfe41ae3bb1b]::query::plumbing::try_execute_query::<rustc_query_impl[9d4c51777e2bb749]::DynamicConfig<rustc_query_system[9b2ccfe41ae3bb1b]::query::caches::SingleCache<rustc_middle[446dd094ad85939e]::query::erase::Erased<[u8; 12usize]>>, false, false, false>, rustc_query_impl[9d4c51777e2bb749]::plumbing::QueryCtxt, false>
  35:     0x7f606e001a05 - rustc_query_impl[9d4c51777e2bb749]::query_impl::entry_fn::get_query_non_incr::__rust_end_short_backtrace
  36:     0x7f606daa2b18 - rustc_interface[7ca501d7f8f3a34f]::passes::analysis
  37:     0x7f606daa2a29 - rustc_query_impl[9d4c51777e2bb749]::plumbing::__rust_begin_short_backtrace::<rustc_query_impl[9d4c51777e2bb749]::query_impl::analysis::dynamic_query::{closure#2}::{closure#0}, rustc_middle[446dd094ad85939e]::query::erase::Erased<[u8; 1usize]>>
  38:     0x7f606dd3d4a5 - rustc_query_system[9b2ccfe41ae3bb1b]::query::plumbing::try_execute_query::<rustc_query_impl[9d4c51777e2bb749]::DynamicConfig<rustc_query_system[9b2ccfe41ae3bb1b]::query::caches::SingleCache<rustc_middle[446dd094ad85939e]::query::erase::Erased<[u8; 1usize]>>, false, false, false>, rustc_query_impl[9d4c51777e2bb749]::plumbing::QueryCtxt, false>
  39:     0x7f606dd3d209 - rustc_query_impl[9d4c51777e2bb749]::query_impl::analysis::get_query_non_incr::__rust_end_short_backtrace
  40:     0x7f606dd4c719 - rustc_interface[7ca501d7f8f3a34f]::interface::run_compiler::<core[85b4fd477ce5bb21]::result::Result<(), rustc_span[adb133ac03280fc1]::ErrorGuaranteed>, rustc_driver_impl[e279e4f1fedd9109]::run_compiler::{closure#0}>::{closure#0}
  41:     0x7f606dfbe705 - std[5a8e7f94216a9138]::sys_common::backtrace::__rust_begin_short_backtrace::<rustc_interface[7ca501d7f8f3a34f]::util::run_in_thread_with_globals<rustc_interface[7ca501d7f8f3a34f]::util::run_in_thread_pool_with_globals<rustc_interface[7ca501d7f8f3a34f]::interface::run_compiler<core[85b4fd477ce5bb21]::result::Result<(), rustc_span[adb133ac03280fc1]::ErrorGuaranteed>, rustc_driver_impl[e279e4f1fedd9109]::run_compiler::{closure#0}>::{closure#0}, core[85b4fd477ce5bb21]::result::Result<(), rustc_span[adb133ac03280fc1]::ErrorGuaranteed>>::{closure#0}, core[85b4fd477ce5bb21]::result::Result<(), rustc_span[adb133ac03280fc1]::ErrorGuaranteed>>::{closure#0}::{closure#0}, core[85b4fd477ce5bb21]::result::Result<(), rustc_span[adb133ac03280fc1]::ErrorGuaranteed>>
  42:     0x7f606dfbe532 - <<std[5a8e7f94216a9138]::thread::Builder>::spawn_unchecked_<rustc_interface[7ca501d7f8f3a34f]::util::run_in_thread_with_globals<rustc_interface[7ca501d7f8f3a34f]::util::run_in_thread_pool_with_globals<rustc_interface[7ca501d7f8f3a34f]::interface::run_compiler<core[85b4fd477ce5bb21]::result::Result<(), rustc_span[adb133ac03280fc1]::ErrorGuaranteed>, rustc_driver_impl[e279e4f1fedd9109]::run_compiler::{closure#0}>::{closure#0}, core[85b4fd477ce5bb21]::result::Result<(), rustc_span[adb133ac03280fc1]::ErrorGuaranteed>>::{closure#0}, core[85b4fd477ce5bb21]::result::Result<(), rustc_span[adb133ac03280fc1]::ErrorGuaranteed>>::{closure#0}::{closure#0}, core[85b4fd477ce5bb21]::result::Result<(), rustc_span[adb133ac03280fc1]::ErrorGuaranteed>>::{closure#1} as core[85b4fd477ce5bb21]::ops::function::FnOnce<()>>::call_once::{shim:vtable#0}
  43:     0x7f6068d99725 - <alloc::boxed::Box<F,A> as core::ops::function::FnOnce<Args>>::call_once::h1bff3efb61c3fa6b
                               at /rustc/f8131a48a46ac3bc8a3d0fe0477055b132cffdc3/library/alloc/src/boxed.rs:2016:9
  44:     0x7f6068d99725 - <alloc::boxed::Box<F,A> as core::ops::function::FnOnce<Args>>::call_once::h83141cf549dced8a
                               at /rustc/f8131a48a46ac3bc8a3d0fe0477055b132cffdc3/library/alloc/src/boxed.rs:2016:9
  45:     0x7f6068d99725 - std::sys::pal::unix::thread::Thread::new::thread_start::hbe9287fdd7c325bc
                               at /rustc/f8131a48a46ac3bc8a3d0fe0477055b132cffdc3/library/std/src/sys/pal/unix/thread.rs:108:17
  46:     0x7f6068b3c9eb - <unknown>
  47:     0x7f6068bc07cc - <unknown>
  48:                0x0 - <unknown>

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 (f8131a48a 2024-02-21) running on x86_64-unknown-linux-gnu

query stack during panic:
#0 [hir_crate] getting the crate HIR
#1 [hir_attrs] getting HIR owner attributes in ``
#2 [entry_fn] looking up the entry function of a crate
#3 [analysis] running analysis passes on this crate
end of query stack
error: aborting due to 3 previous errors

Some errors have detailed explanations: E0405, E0425.
For more information about an error, try `rustc --explain E0405`.

Metadata

Metadata

Assignees

Labels

A-lifetimesArea: Lifetimes / regionsC-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