Skip to content

ICE: couldn't find DefId(..) in the HIR map #114274

Closed
@matthiaskrgr

Description

@matthiaskrgr

Code

#![feature(return_position_impl_trait_in_trait)]

trait Iterable {
    type Item<'a>
    where
        Self: 'a;

    fn iter(&self) -> impl '_ + Iterator<Item = Self::Item<'a>>;
}

Meta

rustc --version --verbose:

rustc 1.73.0-nightly (dfc9d3fee 2023-07-31)
binary: rustc
commit-hash: dfc9d3fee67c1323c396b001197126dbcfa9890e
commit-date: 2023-07-31
host: x86_64-unknown-linux-gnu
release: 1.73.0-nightly
LLVM version: 16.0.5

Error output

error[E0261]: use of undeclared lifetime name `'a`
 --> treereduce.out:8:60
  |
8 |     fn iter(&self) -> impl '_ + Iterator<Item = Self::Item<'a>>;
  |                                                            ^^ undeclared lifetime
  |
  = note: for more information on higher-ranked polymorphism, visit https://doc.rust-lang.org/nomicon/hrtb.html
help: consider making the bound lifetime-generic with a new `'a` lifetime
  |
8 |     fn iter(&self) -> impl '_ + for<'a> Iterator<Item = Self::Item<'a>>;
  |                                 +++++++
help: consider introducing lifetime `'a` here
  |
8 |     fn iter<'a>(&self) -> impl '_ + Iterator<Item = Self::Item<'a>>;
  |            ++++
help: consider introducing lifetime `'a` here
  |
3 | trait Iterable<'a> {
  |               ++++

error[E0601]: `main` function not found in crate `treereduce`
 --> treereduce.out:9:2
  |
9 | }
  |  ^ consider adding a `main` function to `treereduce.out`
Backtrace

error: internal compiler error: compiler/rustc_middle/src/hir/map/mod.rs:331:51: couldn't find DefId(0:10 ~ treereduce[d033]::Iterable::{opaque#0}) in the HIR map

thread 'rustc' panicked at 'Box<dyn Any>', /rustc/dfc9d3fee67c1323c396b001197126dbcfa9890e/compiler/rustc_errors/src/lib.rs:1645:9
stack backtrace:
   0:     0x7fae693634bc - std::backtrace_rs::backtrace::libunwind::trace::hc10f21fc4d155a4b
                               at /rustc/dfc9d3fee67c1323c396b001197126dbcfa9890e/library/std/src/../../backtrace/src/backtrace/libunwind.rs:93:5
   1:     0x7fae693634bc - std::backtrace_rs::backtrace::trace_unsynchronized::h2ff832e7180e98d9
                               at /rustc/dfc9d3fee67c1323c396b001197126dbcfa9890e/library/std/src/../../backtrace/src/backtrace/mod.rs:66:5
   2:     0x7fae693634bc - std::sys_common::backtrace::_print_fmt::h043ce388352e67c2
                               at /rustc/dfc9d3fee67c1323c396b001197126dbcfa9890e/library/std/src/sys_common/backtrace.rs:67:5
   3:     0x7fae693634bc - <std::sys_common::backtrace::_print::DisplayBacktrace as core::fmt::Display>::fmt::h498e95efd8328637
                               at /rustc/dfc9d3fee67c1323c396b001197126dbcfa9890e/library/std/src/sys_common/backtrace.rs:44:22
   4:     0x7fae693c9bac - core::fmt::rt::Argument::fmt::hd8e7c4b15c491909
                               at /rustc/dfc9d3fee67c1323c396b001197126dbcfa9890e/library/core/src/fmt/rt.rs:138:9
   5:     0x7fae693c9bac - core::fmt::write::he8cee201a2769635
                               at /rustc/dfc9d3fee67c1323c396b001197126dbcfa9890e/library/core/src/fmt/mod.rs:1094:21
   6:     0x7fae69355b1e - std::io::Write::write_fmt::h59fd1aad35161370
                               at /rustc/dfc9d3fee67c1323c396b001197126dbcfa9890e/library/std/src/io/mod.rs:1714:15
   7:     0x7fae693632a5 - std::sys_common::backtrace::_print::h114980fc48a15bb8
                               at /rustc/dfc9d3fee67c1323c396b001197126dbcfa9890e/library/std/src/sys_common/backtrace.rs:47:5
   8:     0x7fae693632a5 - std::sys_common::backtrace::print::h1c6b6f7e94b01a83
                               at /rustc/dfc9d3fee67c1323c396b001197126dbcfa9890e/library/std/src/sys_common/backtrace.rs:34:9
   9:     0x7fae693663fa - std::panicking::panic_hook_with_disk_dump::{{closure}}::hd84fa516f1b3c94c
                               at /rustc/dfc9d3fee67c1323c396b001197126dbcfa9890e/library/std/src/panicking.rs:278:22
  10:     0x7fae69366093 - std::panicking::panic_hook_with_disk_dump::hc5c3f3a094fd3ecf
                               at /rustc/dfc9d3fee67c1323c396b001197126dbcfa9890e/library/std/src/panicking.rs:312:9
  11:     0x7fae6c60dcf9 - rustc_driver_impl[9e2f0ef618f016f7]::install_ice_hook::{closure#0}
  12:     0x7fae69366ca0 - <alloc::boxed::Box<F,A> as core::ops::function::Fn<Args>>::call::h6c5ed7c724cacac9
                               at /rustc/dfc9d3fee67c1323c396b001197126dbcfa9890e/library/alloc/src/boxed.rs:2021:9
  13:     0x7fae69366ca0 - std::panicking::rust_panic_with_hook::hb0123c5f4ed863c0
                               at /rustc/dfc9d3fee67c1323c396b001197126dbcfa9890e/library/std/src/panicking.rs:733:13
  14:     0x7fae6cb47921 - std[82a6e3a412bf827d]::panicking::begin_panic::<rustc_errors[366c5cbf427ae7f4]::ExplicitBug>::{closure#0}
  15:     0x7fae6cb450c6 - std[82a6e3a412bf827d]::sys_common::backtrace::__rust_end_short_backtrace::<std[82a6e3a412bf827d]::panicking::begin_panic<rustc_errors[366c5cbf427ae7f4]::ExplicitBug>::{closure#0}, !>
  16:     0x7fae6cbec4d6 - std[82a6e3a412bf827d]::panicking::begin_panic::<rustc_errors[366c5cbf427ae7f4]::ExplicitBug>
  17:     0x7fae6cb820d4 - <rustc_errors[366c5cbf427ae7f4]::HandlerInner>::bug::<alloc[3c1604eb9bdcdaaf]::string::String>
  18:     0x7fae6cb81f66 - <rustc_errors[366c5cbf427ae7f4]::Handler>::bug::<alloc[3c1604eb9bdcdaaf]::string::String>
  19:     0x7fae6cbbcaac - rustc_middle[a9ca302edd61b039]::util::bug::opt_span_bug_fmt::<rustc_span[ad354e94560f53e0]::span_encoding::Span>::{closure#0}
  20:     0x7fae6cbbb8aa - rustc_middle[a9ca302edd61b039]::ty::context::tls::with_opt::<rustc_middle[a9ca302edd61b039]::util::bug::opt_span_bug_fmt<rustc_span[ad354e94560f53e0]::span_encoding::Span>::{closure#0}, !>::{closure#0}
  21:     0x7fae6cbbb878 - rustc_middle[a9ca302edd61b039]::ty::context::tls::with_context_opt::<rustc_middle[a9ca302edd61b039]::ty::context::tls::with_opt<rustc_middle[a9ca302edd61b039]::util::bug::opt_span_bug_fmt<rustc_span[ad354e94560f53e0]::span_encoding::Span>::{closure#0}, !>::{closure#0}, !>
  22:     0x7fae6ae42b70 - rustc_middle[a9ca302edd61b039]::util::bug::bug_fmt
  23:     0x7fae6cb58920 - <rustc_middle[a9ca302edd61b039]::ty::context::TyCtxt>::return_type_impl_trait
  24:     0x7fae6c90f18a - <rustc_infer[5dc369beff54b1d2]::infer::error_reporting::TypeErrCtxt>::construct_generic_bound_failure
  25:     0x7fae6c90da7b - <rustc_infer[5dc369beff54b1d2]::infer::error_reporting::TypeErrCtxt>::report_generic_bound_failure
  26:     0x7fae6c906973 - <rustc_infer[5dc369beff54b1d2]::infer::error_reporting::TypeErrCtxt>::report_region_errors
  27:     0x7fae6b34ee62 - <rustc_trait_selection[cdc3d6d3ba9eff43]::traits::engine::ObligationCtxt>::resolve_regions_and_report_errors
  28:     0x7fae6b34d2cf - rustc_hir_analysis[907b04b50a7934a]::check::wfcheck::check_associated_item
  29:     0x7fae6b348594 - rustc_hir_analysis[907b04b50a7934a]::check::wfcheck::check_well_formed
  30:     0x7fae6a615e5c - rustc_query_impl[330bbb9408a91649]::plumbing::__rust_begin_short_backtrace::<rustc_query_impl[330bbb9408a91649]::query_impl::check_well_formed::dynamic_query::{closure#2}::{closure#0}, rustc_middle[a9ca302edd61b039]::query::erase::Erased<[u8; 0usize]>>
  31:     0x7fae6aff0a36 - rustc_query_system[26a633be2c88f550]::query::plumbing::try_execute_query::<rustc_query_impl[330bbb9408a91649]::DynamicConfig<rustc_query_system[26a633be2c88f550]::query::caches::VecCache<rustc_hir[76f8f52d565447bf]::hir_id::OwnerId, rustc_middle[a9ca302edd61b039]::query::erase::Erased<[u8; 0usize]>>, false, false, false>, rustc_query_impl[330bbb9408a91649]::plumbing::QueryCtxt, false>
  32:     0x7fae6aff0752 - rustc_query_impl[330bbb9408a91649]::query_impl::check_well_formed::get_query_non_incr::__rust_end_short_backtrace
  33:     0x7fae6b586a67 - rustc_data_structures[350f6c207e4c088a]::sync::par_for_each_in::<&[rustc_hir[76f8f52d565447bf]::hir::TraitItemId], <rustc_middle[a9ca302edd61b039]::hir::ModuleItems>::par_trait_items<rustc_hir_analysis[907b04b50a7934a]::check::wfcheck::check_mod_type_wf::{closure#2}>::{closure#0}>
  34:     0x7fae6b586976 - rustc_hir_analysis[907b04b50a7934a]::check::wfcheck::check_mod_type_wf
  35:     0x7fae6b34500c - rustc_query_impl[330bbb9408a91649]::plumbing::__rust_begin_short_backtrace::<rustc_query_impl[330bbb9408a91649]::query_impl::check_mod_type_wf::dynamic_query::{closure#2}::{closure#0}, rustc_middle[a9ca302edd61b039]::query::erase::Erased<[u8; 0usize]>>
  36:     0x7fae6b344fee - <rustc_query_impl[330bbb9408a91649]::query_impl::check_mod_type_wf::dynamic_query::{closure#2} as core[4a0c6aec088930ad]::ops::function::FnOnce<(rustc_middle[a9ca302edd61b039]::ty::context::TyCtxt, rustc_span[ad354e94560f53e0]::def_id::LocalDefId)>>::call_once
  37:     0x7fae6ae1412f - rustc_query_system[26a633be2c88f550]::query::plumbing::try_execute_query::<rustc_query_impl[330bbb9408a91649]::DynamicConfig<rustc_query_system[26a633be2c88f550]::query::caches::VecCache<rustc_span[ad354e94560f53e0]::def_id::LocalDefId, rustc_middle[a9ca302edd61b039]::query::erase::Erased<[u8; 0usize]>>, false, false, false>, rustc_query_impl[330bbb9408a91649]::plumbing::QueryCtxt, false>
  38:     0x7fae6bf7d672 - rustc_query_impl[330bbb9408a91649]::query_impl::check_mod_type_wf::get_query_non_incr::__rust_end_short_backtrace
  39:     0x7fae6bac04a7 - rustc_data_structures[350f6c207e4c088a]::sync::par_for_each_in::<&[rustc_hir[76f8f52d565447bf]::hir_id::OwnerId], <rustc_middle[a9ca302edd61b039]::hir::map::Map>::par_for_each_module<rustc_hir_analysis[907b04b50a7934a]::check_crate::{closure#5}::{closure#0}::{closure#0}>::{closure#0}>
  40:     0x7fae6babf85e - rustc_hir_analysis[907b04b50a7934a]::check_crate
  41:     0x7fae6bab893a - rustc_interface[f3fd4f0030c1b9b0]::passes::analysis
  42:     0x7fae6bb07efa - rustc_query_impl[330bbb9408a91649]::plumbing::__rust_begin_short_backtrace::<rustc_query_impl[330bbb9408a91649]::query_impl::analysis::dynamic_query::{closure#2}::{closure#0}, rustc_middle[a9ca302edd61b039]::query::erase::Erased<[u8; 1usize]>>
  43:     0x7fae6bb07ee9 - <rustc_query_impl[330bbb9408a91649]::query_impl::analysis::dynamic_query::{closure#2} as core[4a0c6aec088930ad]::ops::function::FnOnce<(rustc_middle[a9ca302edd61b039]::ty::context::TyCtxt, ())>>::call_once
  44:     0x7fae6bcb55c8 - rustc_query_system[26a633be2c88f550]::query::plumbing::try_execute_query::<rustc_query_impl[330bbb9408a91649]::DynamicConfig<rustc_query_system[26a633be2c88f550]::query::caches::SingleCache<rustc_middle[a9ca302edd61b039]::query::erase::Erased<[u8; 1usize]>>, false, false, false>, rustc_query_impl[330bbb9408a91649]::plumbing::QueryCtxt, false>
  45:     0x7fae6bcb5357 - rustc_query_impl[330bbb9408a91649]::query_impl::analysis::get_query_non_incr::__rust_end_short_backtrace
  46:     0x7fae6b880b05 - <rustc_middle[a9ca302edd61b039]::ty::context::GlobalCtxt>::enter::<rustc_driver_impl[9e2f0ef618f016f7]::run_compiler::{closure#1}::{closure#2}::{closure#4}, core[4a0c6aec088930ad]::result::Result<(), rustc_span[ad354e94560f53e0]::ErrorGuaranteed>>
  47:     0x7fae6b880132 - <rustc_interface[f3fd4f0030c1b9b0]::interface::Compiler>::enter::<rustc_driver_impl[9e2f0ef618f016f7]::run_compiler::{closure#1}::{closure#2}, core[4a0c6aec088930ad]::result::Result<core[4a0c6aec088930ad]::option::Option<rustc_interface[f3fd4f0030c1b9b0]::queries::Linker>, rustc_span[ad354e94560f53e0]::ErrorGuaranteed>>
  48:     0x7fae6b879208 - std[82a6e3a412bf827d]::sys_common::backtrace::__rust_begin_short_backtrace::<rustc_interface[f3fd4f0030c1b9b0]::util::run_in_thread_pool_with_globals<rustc_interface[f3fd4f0030c1b9b0]::interface::run_compiler<core[4a0c6aec088930ad]::result::Result<(), rustc_span[ad354e94560f53e0]::ErrorGuaranteed>, rustc_driver_impl[9e2f0ef618f016f7]::run_compiler::{closure#1}>::{closure#0}, core[4a0c6aec088930ad]::result::Result<(), rustc_span[ad354e94560f53e0]::ErrorGuaranteed>>::{closure#0}::{closure#0}, core[4a0c6aec088930ad]::result::Result<(), rustc_span[ad354e94560f53e0]::ErrorGuaranteed>>
  49:     0x7fae6be7ac0e - <<std[82a6e3a412bf827d]::thread::Builder>::spawn_unchecked_<rustc_interface[f3fd4f0030c1b9b0]::util::run_in_thread_pool_with_globals<rustc_interface[f3fd4f0030c1b9b0]::interface::run_compiler<core[4a0c6aec088930ad]::result::Result<(), rustc_span[ad354e94560f53e0]::ErrorGuaranteed>, rustc_driver_impl[9e2f0ef618f016f7]::run_compiler::{closure#1}>::{closure#0}, core[4a0c6aec088930ad]::result::Result<(), rustc_span[ad354e94560f53e0]::ErrorGuaranteed>>::{closure#0}::{closure#0}, core[4a0c6aec088930ad]::result::Result<(), rustc_span[ad354e94560f53e0]::ErrorGuaranteed>>::{closure#1} as core[4a0c6aec088930ad]::ops::function::FnOnce<()>>::call_once::{shim:vtable#0}
  50:     0x7fae69371445 - <alloc::boxed::Box<F,A> as core::ops::function::FnOnce<Args>>::call_once::h66fceb181733dd90
                               at /rustc/dfc9d3fee67c1323c396b001197126dbcfa9890e/library/alloc/src/boxed.rs:2007:9
  51:     0x7fae69371445 - <alloc::boxed::Box<F,A> as core::ops::function::FnOnce<Args>>::call_once::h7f69301cadea1541
                               at /rustc/dfc9d3fee67c1323c396b001197126dbcfa9890e/library/alloc/src/boxed.rs:2007:9
  52:     0x7fae69371445 - std::sys::unix::thread::Thread::new::thread_start::h412b508da6e3b759
                               at /rustc/dfc9d3fee67c1323c396b001197126dbcfa9890e/library/std/src/sys/unix/thread.rs:108:17
  53:     0x7fae6910244b - <unknown>
  54:     0x7fae69185e40 - <unknown>
  55:                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: please attach the file at `/tmp/im/rustc-ice-2023-07-31T05:27:41.974492559Z-730516.txt` to your bug report

query stack during panic:
#0 [check_well_formed] checking that `Iterable::iter` is well-formed
#1 [check_mod_type_wf] checking that types are well-formed in top-level module
#2 [analysis] running analysis passes on this crate
end of query stack
error: aborting due to 3 previous errors

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

Metadata

Metadata

Labels

C-bugCategory: This is a bug.F-return_position_impl_trait_in_trait`#![feature(return_position_impl_trait_in_trait)]`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.requires-nightlyThis issue requires a nightly compiler in some way.

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions