Skip to content

ICE: name of non-Rpitit assoc item #139873

Closed
@matthiaskrgr

Description

@matthiaskrgr

auto-reduced (treereduce-rust):

trait AsyncTrait {
    async fn async_dispatch() -> Self::Output;
}

original:

trait AsyncTrait {
    async fn async_dispatch(self: AsyncTrait) -> Self::Output;
}

Version information

rustc 1.88.0-nightly (40dacd50b 2025-04-15)
binary: rustc
commit-hash: 40dacd50b7074783db748d73925ac5c3693a7ec1
commit-date: 2025-04-15
host: x86_64-unknown-linux-gnu
release: 1.88.0-nightly
LLVM version: 20.1.2

Possibly related line of code:

}
}
// Gets the identifier name. Aborts if it lacks one, i.e. is an RPITIT
// associated type.
pub fn name(&self) -> Symbol {
self.opt_name().expect("name of non-Rpitit assoc item")
}
pub fn ident(&self, tcx: TyCtxt<'_>) -> Ident {
Ident::new(self.name(), tcx.def_ident_span(self.def_id).unwrap())
}

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

Program output

error[E0670]: `async fn` is not permitted in Rust 2015
 --> /tmp/icemaker_global_tempdir.9xsoy4O45x2T/rustc_testrunner_tmpdir_reporting.OK9TnYXS9uEw/mvce.rs:2:5
  |
2 |     async fn async_dispatch() -> Self::Output;
  |     ^^^^^ to use `async fn`, switch to Rust 2018 or later
  |
  = help: pass `--edition 2024` to `rustc`
  = note: for more on editions, read https://doc.rust-lang.org/edition-guide

error[E0601]: `main` function not found in crate `mvce`
 --> /tmp/icemaker_global_tempdir.9xsoy4O45x2T/rustc_testrunner_tmpdir_reporting.OK9TnYXS9uEw/mvce.rs:3:2
  |
3 | }
  |  ^ consider adding a `main` function to `/tmp/icemaker_global_tempdir.9xsoy4O45x2T/rustc_testrunner_tmpdir_reporting.OK9TnYXS9uEw/mvce.rs`


thread 'rustc' panicked at compiler/rustc_middle/src/ty/assoc.rs:43:25:
name of non-Rpitit assoc item
stack backtrace:
   0:     0x7315bd4e36f3 - <std::sys::backtrace::BacktraceLock::print::DisplayBacktrace as core::fmt::Display>::fmt::hac1fd18538367f85
   1:     0x7315bdc06087 - core::fmt::write::h355b50e2dd48b7cb
   2:     0x7315bf0aab91 - std::io::Write::write_fmt::h3c208cfcae87fbc5
   3:     0x7315bd4e3552 - std::sys::backtrace::BacktraceLock::print::h52bf60fe66a866b6
   4:     0x7315bd4e703a - std::panicking::default_hook::{{closure}}::ha54cd4f331000bf4
   5:     0x7315bd4e6bbf - std::panicking::default_hook::h65502b75eb6b3c4d
   6:     0x7315bc55b843 - std[6f1f62f9e1890267]::panicking::update_hook::<alloc[9c10c445f94edf6f]::boxed::Box<rustc_driver_impl[261694032873b461]::install_ice_hook::{closure#1}>>::{closure#0}
   7:     0x7315bd4e78b3 - std::panicking::rust_panic_with_hook::h9f8305ffe577d3e1
   8:     0x7315bd4e75aa - std::panicking::begin_panic_handler::{{closure}}::h1196da9ca3c9caa6
   9:     0x7315bd4e3bb9 - std::sys::backtrace::__rust_end_short_backtrace::h209d7d99dc310f1c
  10:     0x7315bd4e726d - __rustc[de9843575c99dce8]::rust_begin_unwind
  11:     0x7315b9e8a680 - core::panicking::panic_fmt::h42dd318a0e6082fa
  12:     0x7315bb02c7cb - core::option::expect_failed::h0db74e3652e9af58
  13:     0x7315bbde4194 - <core[e6c01ae462af1362]::iter::adapters::filter_map::FilterMap<core[e6c01ae462af1362]::iter::adapters::flatten::FlatMap<core[e6c01ae462af1362]::slice::iter::Iter<rustc_span[813b8117367d21e9]::def_id::DefId>, core[e6c01ae462af1362]::iter::adapters::map::Map<core[e6c01ae462af1362]::iter::adapters::map::Map<core[e6c01ae462af1362]::slice::iter::Iter<(core[e6c01ae462af1362]::option::Option<rustc_span[813b8117367d21e9]::symbol::Symbol>, rustc_middle[2dc3a1ceabbabe6a]::ty::assoc::AssocItem)>, <rustc_data_structures[da76f04a30ea89b1]::sorted_map::index_map::SortedIndexMultiMap<u32, core[e6c01ae462af1362]::option::Option<rustc_span[813b8117367d21e9]::symbol::Symbol>, rustc_middle[2dc3a1ceabbabe6a]::ty::assoc::AssocItem>>::iter::{closure#0}>, <rustc_middle[2dc3a1ceabbabe6a]::ty::assoc::AssocItems>::in_definition_order::{closure#0}>, <dyn rustc_hir_analysis[27c52d960688d7c1]::hir_ty_lowering::HirTyLowerer>::complain_about_assoc_item_not_found<rustc_type_ir[6c5f330d44ae87ea]::elaborate::FilterToTraits<rustc_middle[2dc3a1ceabbabe6a]::ty::context::TyCtxt, rustc_type_ir[6c5f330d44ae87ea]::elaborate::Elaborator<rustc_middle[2dc3a1ceabbabe6a]::ty::context::TyCtxt, rustc_middle[2dc3a1ceabbabe6a]::ty::predicate::Clause>>, <dyn rustc_hir_analysis[27c52d960688d7c1]::hir_ty_lowering::HirTyLowerer>::lower_assoc_path_shared::{closure#0}::{closure#1}>::{closure#4}>, <dyn rustc_hir_analysis[27c52d960688d7c1]::hir_ty_lowering::HirTyLowerer>::complain_about_assoc_item_not_found<rustc_type_ir[6c5f330d44ae87ea]::elaborate::FilterToTraits<rustc_middle[2dc3a1ceabbabe6a]::ty::context::TyCtxt, rustc_type_ir[6c5f330d44ae87ea]::elaborate::Elaborator<rustc_middle[2dc3a1ceabbabe6a]::ty::context::TyCtxt, rustc_middle[2dc3a1ceabbabe6a]::ty::predicate::Clause>>, <dyn rustc_hir_analysis[27c52d960688d7c1]::hir_ty_lowering::HirTyLowerer>::lower_assoc_path_shared::{closure#0}::{closure#1}>::{closure#5}> as core[e6c01ae462af1362]::iter::traits::iterator::Iterator>::next
  14:     0x7315be90b1ae - <dyn rustc_hir_analysis[27c52d960688d7c1]::hir_ty_lowering::HirTyLowerer>::probe_single_bound_for_assoc_item::<core[e6c01ae462af1362]::iter::sources::from_fn::FromFn<rustc_infer[455ee0b3b9eb7b54]::traits::util::transitive_bounds_that_define_assoc_item<core[e6c01ae462af1362]::iter::adapters::filter_map::FilterMap<rustc_type_ir[6c5f330d44ae87ea]::binder::IterIdentityCopied<&[(rustc_middle[2dc3a1ceabbabe6a]::ty::predicate::Clause, rustc_span[813b8117367d21e9]::span_encoding::Span)]>, <dyn rustc_hir_analysis[27c52d960688d7c1]::hir_ty_lowering::HirTyLowerer>::probe_single_ty_param_bound_for_assoc_item::{closure#0}::{closure#0}::{closure#0}>>::{closure#0}>, <dyn rustc_hir_analysis[27c52d960688d7c1]::hir_ty_lowering::HirTyLowerer>::probe_single_ty_param_bound_for_assoc_item::{closure#0}::{closure#0}>::{closure#0}
  15:     0x7315be9040ee - <dyn rustc_hir_analysis[27c52d960688d7c1]::hir_ty_lowering::HirTyLowerer>::lower_assoc_path_shared::{closure#0}
  16:     0x7315be903c00 - <dyn rustc_hir_analysis[27c52d960688d7c1]::hir_ty_lowering::HirTyLowerer>::lower_assoc_path_ty
  17:     0x7315bdf11f50 - <dyn rustc_hir_analysis[27c52d960688d7c1]::hir_ty_lowering::HirTyLowerer>::lower_ty
  18:     0x7315be90ff29 - <dyn rustc_hir_analysis[27c52d960688d7c1]::hir_ty_lowering::HirTyLowerer>::lower_assoc_item_constraint
  19:     0x7315bdf07a4f - <dyn rustc_hir_analysis[27c52d960688d7c1]::hir_ty_lowering::HirTyLowerer>::lower_poly_trait_ref
  20:     0x7315bdf06c64 - <dyn rustc_hir_analysis[27c52d960688d7c1]::hir_ty_lowering::HirTyLowerer>::lower_bounds::<&[rustc_hir[7e8dc1ee5e689689]::hir::GenericBound]>
  21:     0x7315bea3663e - rustc_hir_analysis[27c52d960688d7c1]::collect::item_bounds::opaque_type_bounds
  22:     0x7315bea3526f - rustc_hir_analysis[27c52d960688d7c1]::collect::item_bounds::explicit_item_bounds_with_filter
  23:     0x7315bea34e14 - rustc_hir_analysis[27c52d960688d7c1]::collect::item_bounds::explicit_item_bounds
  24:     0x7315bea34de7 - rustc_query_impl[ad69a23e50a8fbd1]::plumbing::__rust_begin_short_backtrace::<rustc_query_impl[ad69a23e50a8fbd1]::query_impl::explicit_item_bounds::dynamic_query::{closure#2}::{closure#0}, rustc_middle[2dc3a1ceabbabe6a]::query::erase::Erased<[u8; 16usize]>>
  25:     0x7315bea34dab - <rustc_query_impl[ad69a23e50a8fbd1]::query_impl::explicit_item_bounds::dynamic_query::{closure#2} as core[e6c01ae462af1362]::ops::function::FnOnce<(rustc_middle[2dc3a1ceabbabe6a]::ty::context::TyCtxt, rustc_span[813b8117367d21e9]::def_id::DefId)>>::call_once
  26:     0x7315bde29900 - rustc_query_system[8ca381065095edd4]::query::plumbing::try_execute_query::<rustc_query_impl[ad69a23e50a8fbd1]::DynamicConfig<rustc_query_system[8ca381065095edd4]::query::caches::DefIdCache<rustc_middle[2dc3a1ceabbabe6a]::query::erase::Erased<[u8; 16usize]>>, false, false, false>, rustc_query_impl[ad69a23e50a8fbd1]::plumbing::QueryCtxt, false>
  27:     0x7315be57eb60 - rustc_query_impl[ad69a23e50a8fbd1]::query_impl::explicit_item_bounds::get_query_non_incr::__rust_end_short_backtrace
  28:     0x7315bede98bf - <rustc_hir_analysis[27c52d960688d7c1]::collect::CollectItemTypesVisitor as rustc_hir[7e8dc1ee5e689689]::intravisit::Visitor>::visit_opaque_ty
  29:     0x7315be3da2ea - <rustc_hir_analysis[27c52d960688d7c1]::collect::CollectItemTypesVisitor as rustc_hir[7e8dc1ee5e689689]::intravisit::Visitor>::visit_trait_item
  30:     0x7315be3cc87f - rustc_hir_analysis[27c52d960688d7c1]::check::wfcheck::check_well_formed
  31:     0x7315be3ca3eb - rustc_query_impl[ad69a23e50a8fbd1]::plumbing::__rust_begin_short_backtrace::<rustc_query_impl[ad69a23e50a8fbd1]::query_impl::check_well_formed::dynamic_query::{closure#2}::{closure#0}, rustc_middle[2dc3a1ceabbabe6a]::query::erase::Erased<[u8; 1usize]>>
  32:     0x7315be3c9c94 - rustc_query_system[8ca381065095edd4]::query::plumbing::try_execute_query::<rustc_query_impl[ad69a23e50a8fbd1]::DynamicConfig<rustc_data_structures[da76f04a30ea89b1]::vec_cache::VecCache<rustc_span[813b8117367d21e9]::def_id::LocalDefId, rustc_middle[2dc3a1ceabbabe6a]::query::erase::Erased<[u8; 1usize]>, rustc_query_system[8ca381065095edd4]::dep_graph::graph::DepNodeIndex>, false, false, false>, rustc_query_impl[ad69a23e50a8fbd1]::plumbing::QueryCtxt, false>
  33:     0x7315be3c9783 - rustc_query_impl[ad69a23e50a8fbd1]::query_impl::check_well_formed::get_query_non_incr::__rust_end_short_backtrace
  34:     0x7315be3c5f47 - rustc_hir_analysis[27c52d960688d7c1]::check::wfcheck::check_mod_type_wf
  35:     0x7315be3c59dd - rustc_query_impl[ad69a23e50a8fbd1]::plumbing::__rust_begin_short_backtrace::<rustc_query_impl[ad69a23e50a8fbd1]::query_impl::check_mod_type_wf::dynamic_query::{closure#2}::{closure#0}, rustc_middle[2dc3a1ceabbabe6a]::query::erase::Erased<[u8; 1usize]>>
  36:     0x7315becd9159 - rustc_query_system[8ca381065095edd4]::query::plumbing::try_execute_query::<rustc_query_impl[ad69a23e50a8fbd1]::DynamicConfig<rustc_query_system[8ca381065095edd4]::query::caches::DefaultCache<rustc_span[813b8117367d21e9]::def_id::LocalModDefId, rustc_middle[2dc3a1ceabbabe6a]::query::erase::Erased<[u8; 1usize]>>, false, false, false>, rustc_query_impl[ad69a23e50a8fbd1]::plumbing::QueryCtxt, false>
  37:     0x7315becd8eca - rustc_query_impl[ad69a23e50a8fbd1]::query_impl::check_mod_type_wf::get_query_non_incr::__rust_end_short_backtrace
  38:     0x7315bde67166 - rustc_hir_analysis[27c52d960688d7c1]::check_crate
  39:     0x7315be00c8f2 - rustc_interface[f2198cb0de4afffb]::passes::run_required_analyses
  40:     0x7315be755f9e - rustc_interface[f2198cb0de4afffb]::passes::analysis
  41:     0x7315be755f73 - rustc_query_impl[ad69a23e50a8fbd1]::plumbing::__rust_begin_short_backtrace::<rustc_query_impl[ad69a23e50a8fbd1]::query_impl::analysis::dynamic_query::{closure#2}::{closure#0}, rustc_middle[2dc3a1ceabbabe6a]::query::erase::Erased<[u8; 0usize]>>
  42:     0x7315bebfb73d - rustc_query_system[8ca381065095edd4]::query::plumbing::try_execute_query::<rustc_query_impl[ad69a23e50a8fbd1]::DynamicConfig<rustc_query_system[8ca381065095edd4]::query::caches::SingleCache<rustc_middle[2dc3a1ceabbabe6a]::query::erase::Erased<[u8; 0usize]>>, false, false, false>, rustc_query_impl[ad69a23e50a8fbd1]::plumbing::QueryCtxt, false>
  43:     0x7315bebfb438 - rustc_query_impl[ad69a23e50a8fbd1]::query_impl::analysis::get_query_non_incr::__rust_end_short_backtrace
  44:     0x7315bef1b47e - rustc_interface[f2198cb0de4afffb]::passes::create_and_enter_global_ctxt::<core[e6c01ae462af1362]::option::Option<rustc_interface[f2198cb0de4afffb]::queries::Linker>, rustc_driver_impl[261694032873b461]::run_compiler::{closure#0}::{closure#2}>::{closure#2}::{closure#0}
  45:     0x7315bed0d904 - rustc_interface[f2198cb0de4afffb]::interface::run_compiler::<(), rustc_driver_impl[261694032873b461]::run_compiler::{closure#0}>::{closure#1}
  46:     0x7315beaee028 - std[6f1f62f9e1890267]::sys::backtrace::__rust_begin_short_backtrace::<rustc_interface[f2198cb0de4afffb]::util::run_in_thread_with_globals<rustc_interface[f2198cb0de4afffb]::util::run_in_thread_pool_with_globals<rustc_interface[f2198cb0de4afffb]::interface::run_compiler<(), rustc_driver_impl[261694032873b461]::run_compiler::{closure#0}>::{closure#1}, ()>::{closure#0}, ()>::{closure#0}::{closure#0}, ()>
  47:     0x7315beaee92b - <<std[6f1f62f9e1890267]::thread::Builder>::spawn_unchecked_<rustc_interface[f2198cb0de4afffb]::util::run_in_thread_with_globals<rustc_interface[f2198cb0de4afffb]::util::run_in_thread_pool_with_globals<rustc_interface[f2198cb0de4afffb]::interface::run_compiler<(), rustc_driver_impl[261694032873b461]::run_compiler::{closure#0}>::{closure#1}, ()>::{closure#0}, ()>::{closure#0}::{closure#0}, ()>::{closure#1} as core[e6c01ae462af1362]::ops::function::FnOnce<()>>::call_once::{shim:vtable#0}
  48:     0x7315beaefd37 - std::sys::pal::unix::thread::Thread::new::thread_start::he9943a285b1830ff
  49:     0x7315b8aa370a - <unknown>
  50:     0x7315b8b27aac - <unknown>
  51:                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: please make sure that you have updated to the latest nightly

note: rustc 1.88.0-nightly (40dacd50b 2025-04-15) running on x86_64-unknown-linux-gnu

query stack during panic:
#0 [explicit_item_bounds] finding item bounds for `AsyncTrait::async_dispatch::{opaque#0}`
#1 [check_well_formed] checking that `AsyncTrait::async_dispatch` is well-formed
#2 [check_mod_type_wf] checking that types are well-formed in top-level module
#3 [analysis] running analysis passes on this crate
end of query stack
error: aborting due to 2 previous errors

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

Metadata

Metadata

Assignees

No one assigned

    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