Skip to content

ICE: thread 'rustc' panicked at 'DefId(2:4314 ~ core[ecd7]::cell::Ref::'b) does not have a "def_span"' #110464

Closed
@matthiaskrgr

Description

@matthiaskrgr

cc @compiler-errors
still crashes after #110425

Code

impl<'a, 'tcx> std::cell::Ref<'a, 'tcx> {}

Meta

rustc --version --verbose:

rustc 1.71.0-nightly (31656e729 2023-04-17)
binary: rustc
commit-hash: 31656e7295ebd5f2f6597f10c011e2ac4ba3ef39
commit-date: 2023-04-17
host: x86_64-unknown-linux-gnu
release: 1.71.0-nightly
LLVM version: 16.0.2

Error output

error[E0601]: `main` function not found in crate `treereduce`
 --> treereduce.out:1:43
  |
1 | impl<'a, 'tcx> std::cell::Ref<'a, 'tcx> {}
  |                                           ^ consider adding a `main` function to `treereduce.out`
Backtrace

thread 'rustc' panicked at 'DefId(2:4314 ~ core[ecd7]::cell::Ref::'b) does not have a "def_span"', compiler/rustc_metadata/src/rmeta/decoder/cstore_impl.rs:205:1
stack backtrace:
   0:     0x7f4ead3653c2 - std::backtrace_rs::backtrace::libunwind::trace::h12fb0181e6282928
                               at /rustc/31656e7295ebd5f2f6597f10c011e2ac4ba3ef39/library/std/src/../../backtrace/src/backtrace/libunwind.rs:93:5
   1:     0x7f4ead3653c2 - std::backtrace_rs::backtrace::trace_unsynchronized::hd58a23b488ab4414
                               at /rustc/31656e7295ebd5f2f6597f10c011e2ac4ba3ef39/library/std/src/../../backtrace/src/backtrace/mod.rs:66:5
   2:     0x7f4ead3653c2 - std::sys_common::backtrace::_print_fmt::h1e92ee6e175ed435
                               at /rustc/31656e7295ebd5f2f6597f10c011e2ac4ba3ef39/library/std/src/sys_common/backtrace.rs:65:5
   3:     0x7f4ead3653c2 - <std::sys_common::backtrace::_print::DisplayBacktrace as core::fmt::Display>::fmt::he25ddff8a40f4065
                               at /rustc/31656e7295ebd5f2f6597f10c011e2ac4ba3ef39/library/std/src/sys_common/backtrace.rs:44:22
   4:     0x7f4ead3c95df - core::fmt::write::h2334c3311cfbc09f
                               at /rustc/31656e7295ebd5f2f6597f10c011e2ac4ba3ef39/library/core/src/fmt/mod.rs:1254:17
   5:     0x7f4ead358371 - std::io::Write::write_fmt::h32ceba1e85ba39af
                               at /rustc/31656e7295ebd5f2f6597f10c011e2ac4ba3ef39/library/std/src/io/mod.rs:1698:15
   6:     0x7f4ead3651c5 - std::sys_common::backtrace::_print::headbc582bfe8f74f
                               at /rustc/31656e7295ebd5f2f6597f10c011e2ac4ba3ef39/library/std/src/sys_common/backtrace.rs:47:5
   7:     0x7f4ead3651c5 - std::sys_common::backtrace::print::h9fbeedaf474e45ad
                               at /rustc/31656e7295ebd5f2f6597f10c011e2ac4ba3ef39/library/std/src/sys_common/backtrace.rs:34:9
   8:     0x7f4ead367e87 - std::panicking::default_hook::{{closure}}::hff4b7a4e67c75e45
   9:     0x7f4ead367c75 - std::panicking::default_hook::h2ca9686b025551a8
                               at /rustc/31656e7295ebd5f2f6597f10c011e2ac4ba3ef39/library/std/src/panicking.rs:288:9
  10:     0x7f4eb0631d45 - <rustc_driver_impl[19ce8278adc32abb]::DEFAULT_HOOK::{closure#0}::{closure#0} as core[ecd79567034e570c]::ops::function::FnOnce<(&core[ecd79567034e570c]::panic::panic_info::PanicInfo,)>>::call_once::{shim:vtable#0}
  11:     0x7f4ead3685c5 - <alloc::boxed::Box<F,A> as core::ops::function::Fn<Args>>::call::h97aef67d40dea969
                               at /rustc/31656e7295ebd5f2f6597f10c011e2ac4ba3ef39/library/alloc/src/boxed.rs:1987:9
  12:     0x7f4ead3685c5 - std::panicking::rust_panic_with_hook::h8edf350457ba7c57
                               at /rustc/31656e7295ebd5f2f6597f10c011e2ac4ba3ef39/library/std/src/panicking.rs:695:13
  13:     0x7f4ead368339 - std::panicking::begin_panic_handler::{{closure}}::h2bd4d1302fd9063e
                               at /rustc/31656e7295ebd5f2f6597f10c011e2ac4ba3ef39/library/std/src/panicking.rs:582:13
  14:     0x7f4ead365806 - std::sys_common::backtrace::__rust_end_short_backtrace::h30f581c97642f13f
                               at /rustc/31656e7295ebd5f2f6597f10c011e2ac4ba3ef39/library/std/src/sys_common/backtrace.rs:150:18
  15:     0x7f4ead368092 - rust_begin_unwind
                               at /rustc/31656e7295ebd5f2f6597f10c011e2ac4ba3ef39/library/std/src/panicking.rs:578:5
  16:     0x7f4ead3c5953 - core::panicking::panic_fmt::h1e15b8ac1469fe52
                               at /rustc/31656e7295ebd5f2f6597f10c011e2ac4ba3ef39/library/core/src/panicking.rs:67:14
  17:     0x7f4eb0a5e312 - rustc_metadata[572c2c8f30736a78]::rmeta::decoder::cstore_impl::provide_extern::def_span::{closure#2}
  18:     0x7f4eaf123c02 - rustc_query_system[8013f3037cfe4f42]::query::plumbing::try_execute_query::<rustc_query_impl[d100f3cda631c9d2]::queries::def_span, rustc_query_impl[d100f3cda631c9d2]::plumbing::QueryCtxt>
  19:     0x7f4eaf12208a - <rustc_query_impl[d100f3cda631c9d2]::Queries as rustc_middle[a098ebc07bc191ee]::ty::query::QueryEngine>::def_span
  20:     0x7f4eb070f924 - <&mut <rustc_hir_analysis[18d38fd7f32cb571]::structured_errors::wrong_number_of_generic_args::WrongNumberOfGenericArgs>::show_definition::{closure#0} as core[ecd79567034e570c]::ops::function::FnOnce<(&rustc_middle[a098ebc07bc191ee]::ty::generics::GenericParamDef,)>>::call_once
  21:     0x7f4eb077fd6c - <alloc[b29edc6afdbb639a]::vec::Vec<alloc[b29edc6afdbb639a]::string::String> as alloc[b29edc6afdbb639a]::vec::spec_from_iter::SpecFromIter<alloc[b29edc6afdbb639a]::string::String, core[ecd79567034e570c]::iter::adapters::map::Map<core[ecd79567034e570c]::iter::adapters::map::Map<core[ecd79567034e570c]::iter::adapters::take::Take<core[ecd79567034e570c]::iter::adapters::skip::Skip<core[ecd79567034e570c]::slice::iter::Iter<rustc_middle[a098ebc07bc191ee]::ty::generics::GenericParamDef>>>, <rustc_hir_analysis[18d38fd7f32cb571]::structured_errors::wrong_number_of_generic_args::WrongNumberOfGenericArgs>::show_definition::{closure#0}>, <rustc_hir_analysis[18d38fd7f32cb571]::structured_errors::wrong_number_of_generic_args::WrongNumberOfGenericArgs>::show_definition::{closure#1}>>>::from_iter
  22:     0x7f4eb0714480 - <rustc_hir_analysis[18d38fd7f32cb571]::structured_errors::wrong_number_of_generic_args::WrongNumberOfGenericArgs as rustc_hir_analysis[18d38fd7f32cb571]::structured_errors::StructuredDiagnostic>::diagnostic_common
  23:     0x7f4eb0715af2 - <rustc_hir_analysis[18d38fd7f32cb571]::structured_errors::wrong_number_of_generic_args::WrongNumberOfGenericArgs as rustc_hir_analysis[18d38fd7f32cb571]::structured_errors::StructuredDiagnostic>::diagnostic
  24:     0x7f4eaf47b4c4 - <dyn rustc_hir_analysis[18d38fd7f32cb571]::astconv::AstConv>::res_to_ty
  25:     0x7f4eaf46ff80 - <dyn rustc_hir_analysis[18d38fd7f32cb571]::astconv::AstConv>::ast_ty_to_ty_inner::{closure#0}
  26:     0x7f4eaf96bbe2 - rustc_hir_analysis[18d38fd7f32cb571]::collect::type_of::type_of
  27:     0x7f4eaec3040d - rustc_query_system[8013f3037cfe4f42]::query::plumbing::try_execute_query::<rustc_query_impl[d100f3cda631c9d2]::queries::type_of, rustc_query_impl[d100f3cda631c9d2]::plumbing::QueryCtxt>
  28:     0x7f4eaec2f72f - <rustc_query_impl[d100f3cda631c9d2]::Queries as rustc_middle[a098ebc07bc191ee]::ty::query::QueryEngine>::type_of
  29:     0x7f4eae9ed2fc - <rustc_hir_analysis[18d38fd7f32cb571]::collect::CollectItemTypesVisitor as rustc_hir[884f393f1859d8a7]::intravisit::Visitor>::visit_item
  30:     0x7f4eae9eb6c2 - <rustc_middle[a098ebc07bc191ee]::hir::map::Map>::visit_item_likes_in_module::<rustc_hir_analysis[18d38fd7f32cb571]::collect::CollectItemTypesVisitor>
  31:     0x7f4eae9eb5ec - rustc_hir_analysis[18d38fd7f32cb571]::collect::collect_mod_item_types
  32:     0x7f4eafc65321 - rustc_query_system[8013f3037cfe4f42]::query::plumbing::try_execute_query::<rustc_query_impl[d100f3cda631c9d2]::queries::collect_mod_item_types, rustc_query_impl[d100f3cda631c9d2]::plumbing::QueryCtxt>
  33:     0x7f4eafc64f49 - <rustc_query_impl[d100f3cda631c9d2]::Queries as rustc_middle[a098ebc07bc191ee]::ty::query::QueryEngine>::collect_mod_item_types
  34:     0x7f4eafa0467c - <rustc_middle[a098ebc07bc191ee]::hir::map::Map>::for_each_module::<rustc_hir_analysis[18d38fd7f32cb571]::check_crate::{closure#0}::{closure#0}::{closure#0}>
  35:     0x7f4eafa008cc - rustc_hir_analysis[18d38fd7f32cb571]::check_crate
  36:     0x7f4eaf9fad1d - rustc_interface[e2b40ad4e6aa2c15]::passes::analysis
  37:     0x7f4eafd9a562 - rustc_query_system[8013f3037cfe4f42]::query::plumbing::try_execute_query::<rustc_query_impl[d100f3cda631c9d2]::queries::analysis, rustc_query_impl[d100f3cda631c9d2]::plumbing::QueryCtxt>
  38:     0x7f4eafd9a270 - <rustc_query_impl[d100f3cda631c9d2]::Queries as rustc_middle[a098ebc07bc191ee]::ty::query::QueryEngine>::analysis
  39:     0x7f4eafc5e8e6 - <std[44a4f6cc0231f9b2]::thread::local::LocalKey<core[ecd79567034e570c]::cell::Cell<*const ()>>>::with::<rustc_middle[a098ebc07bc191ee]::ty::context::tls::enter_context<<rustc_middle[a098ebc07bc191ee]::ty::context::GlobalCtxt>::enter<rustc_driver_impl[19ce8278adc32abb]::run_compiler::{closure#1}::{closure#2}::{closure#4}, core[ecd79567034e570c]::result::Result<(), rustc_span[bacfd568afc27ca7]::ErrorGuaranteed>>::{closure#0}, core[ecd79567034e570c]::result::Result<(), rustc_span[bacfd568afc27ca7]::ErrorGuaranteed>>::{closure#0}, core[ecd79567034e570c]::result::Result<(), rustc_span[bacfd568afc27ca7]::ErrorGuaranteed>>
  40:     0x7f4eaf81da67 - <rustc_interface[e2b40ad4e6aa2c15]::interface::Compiler>::enter::<rustc_driver_impl[19ce8278adc32abb]::run_compiler::{closure#1}::{closure#2}, core[ecd79567034e570c]::result::Result<core[ecd79567034e570c]::option::Option<rustc_interface[e2b40ad4e6aa2c15]::queries::Linker>, rustc_span[bacfd568afc27ca7]::ErrorGuaranteed>>
  41:     0x7f4eaf817b4f - rustc_span[bacfd568afc27ca7]::set_source_map::<core[ecd79567034e570c]::result::Result<(), rustc_span[bacfd568afc27ca7]::ErrorGuaranteed>, rustc_interface[e2b40ad4e6aa2c15]::interface::run_compiler<core[ecd79567034e570c]::result::Result<(), rustc_span[bacfd568afc27ca7]::ErrorGuaranteed>, rustc_driver_impl[19ce8278adc32abb]::run_compiler::{closure#1}>::{closure#0}::{closure#0}>
  42:     0x7f4eaf817768 - <scoped_tls[41028e5492da81b4]::ScopedKey<rustc_span[bacfd568afc27ca7]::SessionGlobals>>::set::<rustc_interface[e2b40ad4e6aa2c15]::interface::run_compiler<core[ecd79567034e570c]::result::Result<(), rustc_span[bacfd568afc27ca7]::ErrorGuaranteed>, rustc_driver_impl[19ce8278adc32abb]::run_compiler::{closure#1}>::{closure#0}, core[ecd79567034e570c]::result::Result<(), rustc_span[bacfd568afc27ca7]::ErrorGuaranteed>>
  43:     0x7f4eaf816d7b - std[44a4f6cc0231f9b2]::sys_common::backtrace::__rust_begin_short_backtrace::<rustc_interface[e2b40ad4e6aa2c15]::util::run_in_thread_pool_with_globals<rustc_interface[e2b40ad4e6aa2c15]::interface::run_compiler<core[ecd79567034e570c]::result::Result<(), rustc_span[bacfd568afc27ca7]::ErrorGuaranteed>, rustc_driver_impl[19ce8278adc32abb]::run_compiler::{closure#1}>::{closure#0}, core[ecd79567034e570c]::result::Result<(), rustc_span[bacfd568afc27ca7]::ErrorGuaranteed>>::{closure#0}::{closure#0}, core[ecd79567034e570c]::result::Result<(), rustc_span[bacfd568afc27ca7]::ErrorGuaranteed>>
  44:     0x7f4eafef9161 - <<std[44a4f6cc0231f9b2]::thread::Builder>::spawn_unchecked_<rustc_interface[e2b40ad4e6aa2c15]::util::run_in_thread_pool_with_globals<rustc_interface[e2b40ad4e6aa2c15]::interface::run_compiler<core[ecd79567034e570c]::result::Result<(), rustc_span[bacfd568afc27ca7]::ErrorGuaranteed>, rustc_driver_impl[19ce8278adc32abb]::run_compiler::{closure#1}>::{closure#0}, core[ecd79567034e570c]::result::Result<(), rustc_span[bacfd568afc27ca7]::ErrorGuaranteed>>::{closure#0}::{closure#0}, core[ecd79567034e570c]::result::Result<(), rustc_span[bacfd568afc27ca7]::ErrorGuaranteed>>::{closure#1} as core[ecd79567034e570c]::ops::function::FnOnce<()>>::call_once::{shim:vtable#0}
  45:     0x7f4ead372a85 - <alloc::boxed::Box<F,A> as core::ops::function::FnOnce<Args>>::call_once::hf699fb692a362d4f
                               at /rustc/31656e7295ebd5f2f6597f10c011e2ac4ba3ef39/library/alloc/src/boxed.rs:1973:9
  46:     0x7f4ead372a85 - <alloc::boxed::Box<F,A> as core::ops::function::FnOnce<Args>>::call_once::h5785a67d99b09647
                               at /rustc/31656e7295ebd5f2f6597f10c011e2ac4ba3ef39/library/alloc/src/boxed.rs:1973:9
  47:     0x7f4ead372a85 - std::sys::unix::thread::Thread::new::thread_start::hd8d3f6147809d6cf
                               at /rustc/31656e7295ebd5f2f6597f10c011e2ac4ba3ef39/library/std/src/sys/unix/thread.rs:108:17
  48:     0x7f4ead10dbb5 - <unknown>
  49:     0x7f4ead18fd90 - <unknown>
  50:                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.71.0-nightly (31656e729 2023-04-17) running on x86_64-unknown-linux-gnu

query stack during panic:
#0 [def_span] looking up span for `core::cell::Ref::'b`
#1 [type_of] computing type of `<impl at treereduce.out:1:1: 1:40>`
#2 [collect_mod_item_types] collecting item types in top-level module
#3 [analysis] running analysis passes on this crate
end of query stack
error: aborting due to previous error

For more information about this error, try `rustc --explain E0601`.

Metadata

Metadata

Labels

C-bugCategory: This is a bug.I-ICEIssue: The compiler panicked, giving an Internal Compilation Error (ICE) ❄️S-has-mcveStatus: A Minimal Complete and Verifiable Example has been found for this issueT-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