Skip to content

ICE: name of non-Rpitit assoc item (episode 2) #139941

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed
matthiaskrgr opened this issue Apr 16, 2025 · 1 comment · Fixed by #139981
Closed

ICE: name of non-Rpitit assoc item (episode 2) #139941

matthiaskrgr opened this issue Apr 16, 2025 · 1 comment · Fixed by #139981
Assignees
Labels
C-bug Category: This is a bug. I-ICE Issue: The compiler panicked, giving an Internal Compilation Error (ICE) ❄️ T-compiler Relevant to the compiler team, which will review and decide on the PR/issue.

Comments

@matthiaskrgr
Copy link
Member

the saga continues!

auto-reduced (treereduce-rust):

trait Foo {
    fn test() -> impl Foo(u32) -> u32 {}
}

original:

trait Foo {
    fn test() -> impl Foo(u32) -> u32 {
        || x.count_ones()
    }
}

Version information

rustc 1.88.0-nightly (78f2104e3 2025-04-16)
binary: rustc
commit-hash: 78f2104e334068d5a892a170d50193c0025c690e
commit-date: 2025-04-16
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[E0601]: `main` function not found in crate `mvce`
 --> /tmp/icemaker_global_tempdir.JNaW56ApoC9W/rustc_testrunner_tmpdir_reporting.WdMzLCnsDMQF/mvce.rs:3:2
  |
3 | }
  |  ^ consider adding a `main` function to `/tmp/icemaker_global_tempdir.JNaW56ApoC9W/rustc_testrunner_tmpdir_reporting.WdMzLCnsDMQF/mvce.rs`

error[E0658]: parenthetical notation is only stable when used with `Fn`-family traits
 --> /tmp/icemaker_global_tempdir.JNaW56ApoC9W/rustc_testrunner_tmpdir_reporting.WdMzLCnsDMQF/mvce.rs:2:23
  |
2 |     fn test() -> impl Foo(u32) -> u32 {}
  |                       ^^^^^^^^^^^^^^^
  |
  = note: see issue #29625 <https://github.com/rust-lang/rust/issues/29625> for more information
  = help: add `#![feature(unboxed_closures)]` to the crate attributes to enable
  = note: this compiler was built on 2025-04-16; consider upgrading it if it is out of date


thread 'rustc' panicked at compiler/rustc_middle/src/ty/assoc.rs:43:25:
name of non-Rpitit assoc item
stack backtrace:
   0:     0x7d0bb86e87b3 - <std::sys::backtrace::BacktraceLock::print::DisplayBacktrace as core::fmt::Display>::fmt::hbe9a35f36773aa35
   1:     0x7d0bb8e05b07 - core::fmt::write::hc5bf8d0f3fe78c0c
   2:     0x7d0bba2a6011 - std::io::Write::write_fmt::ha84e19e9665c5650
   3:     0x7d0bb86e8612 - std::sys::backtrace::BacktraceLock::print::h8bb069e50731329e
   4:     0x7d0bb86ebf8a - std::panicking::default_hook::{{closure}}::h9d41ab1a4babb09c
   5:     0x7d0bb86ebb0f - std::panicking::default_hook::h6eac92de6962e409
   6:     0x7d0bb775a5b3 - std[2ad6d0fee2e09edc]::panicking::update_hook::<alloc[9d3eded591b7d627]::boxed::Box<rustc_driver_impl[5fbee50f607e217]::install_ice_hook::{closure#1}>>::{closure#0}
   7:     0x7d0bb86ec803 - std::panicking::rust_panic_with_hook::hfe63a727073f604a
   8:     0x7d0bb86ec4fa - std::panicking::begin_panic_handler::{{closure}}::h92b47807861c6a3c
   9:     0x7d0bb86e8c89 - std::sys::backtrace::__rust_end_short_backtrace::hb9f6a948a925f382
  10:     0x7d0bb86ec1bd - __rustc[9e5fbd37ce37ba6c]::rust_begin_unwind
  11:     0x7d0bb508d1c0 - core::panicking::panic_fmt::hcb046f91e9c65441
  12:     0x7d0bb6393fab - core::option::expect_failed::hb997976540264db6
  13:     0x7d0bb78de395 - <core[58638a26b282635c]::iter::adapters::map::Map<core[58638a26b282635c]::iter::adapters::filter::Filter<core[58638a26b282635c]::iter::adapters::filter::Filter<core[58638a26b282635c]::iter::adapters::filter::Filter<core[58638a26b282635c]::iter::adapters::map::Map<core[58638a26b282635c]::iter::adapters::map::Map<core[58638a26b282635c]::slice::iter::Iter<(core[58638a26b282635c]::option::Option<rustc_span[85c7266a28769ec9]::symbol::Symbol>, rustc_middle[9902b4682aa0495d]::ty::assoc::AssocItem)>, <rustc_data_structures[2fd0664b6811e02d]::sorted_map::index_map::SortedIndexMultiMap<u32, core[58638a26b282635c]::option::Option<rustc_span[85c7266a28769ec9]::symbol::Symbol>, rustc_middle[9902b4682aa0495d]::ty::assoc::AssocItem>>::iter::{closure#0}>, <rustc_middle[9902b4682aa0495d]::ty::assoc::AssocItems>::in_definition_order::{closure#0}>, <rustc_hir_analysis[97d869527a21e1a5]::errors::wrong_number_of_generic_args::WrongNumberOfGenericArgs>::get_unbound_associated_types::{closure#0}>, <rustc_hir_analysis[97d869527a21e1a5]::errors::wrong_number_of_generic_args::WrongNumberOfGenericArgs>::get_unbound_associated_types::{closure#1}>, <rustc_hir_analysis[97d869527a21e1a5]::errors::wrong_number_of_generic_args::WrongNumberOfGenericArgs>::get_unbound_associated_types::{closure#2}>, <rustc_hir_analysis[97d869527a21e1a5]::errors::wrong_number_of_generic_args::WrongNumberOfGenericArgs>::get_unbound_associated_types::{closure#3}> as core[58638a26b282635c]::iter::traits::iterator::Iterator>::next
  14:     0x7d0bb793efd7 - <rustc_hir_analysis[97d869527a21e1a5]::errors::wrong_number_of_generic_args::WrongNumberOfGenericArgs>::get_unbound_associated_types
  15:     0x7d0bb7942be7 - <rustc_hir_analysis[97d869527a21e1a5]::errors::wrong_number_of_generic_args::WrongNumberOfGenericArgs as rustc_errors[fd960650b33fb9c4]::diagnostic::Diagnostic>::into_diag
  16:     0x7d0bb90e431b - <dyn rustc_hir_analysis[97d869527a21e1a5]::hir_ty_lowering::HirTyLowerer>::lower_generic_args_of_path::{closure#0}
  17:     0x7d0bb90dd639 - <dyn rustc_hir_analysis[97d869527a21e1a5]::hir_ty_lowering::HirTyLowerer>::lower_poly_trait_ref
  18:     0x7d0bb90dcba4 - <dyn rustc_hir_analysis[97d869527a21e1a5]::hir_ty_lowering::HirTyLowerer>::lower_bounds::<&[rustc_hir[603e0a66c7ecd982]::hir::GenericBound]>
  19:     0x7d0bb9a40d61 - rustc_hir_analysis[97d869527a21e1a5]::collect::item_bounds::associated_type_bounds
  20:     0x7d0bb9a403d4 - rustc_hir_analysis[97d869527a21e1a5]::collect::item_bounds::explicit_item_bounds
  21:     0x7d0bb9a403a7 - rustc_query_impl[2236df548ee42a79]::plumbing::__rust_begin_short_backtrace::<rustc_query_impl[2236df548ee42a79]::query_impl::explicit_item_bounds::dynamic_query::{closure#2}::{closure#0}, rustc_middle[9902b4682aa0495d]::query::erase::Erased<[u8; 16usize]>>
  22:     0x7d0bb9a4036b - <rustc_query_impl[2236df548ee42a79]::query_impl::explicit_item_bounds::dynamic_query::{closure#2} as core[58638a26b282635c]::ops::function::FnOnce<(rustc_middle[9902b4682aa0495d]::ty::context::TyCtxt, rustc_span[85c7266a28769ec9]::def_id::DefId)>>::call_once
  23:     0x7d0bb9001f10 - rustc_query_system[be2b43304ba7dfb]::query::plumbing::try_execute_query::<rustc_query_impl[2236df548ee42a79]::DynamicConfig<rustc_query_system[be2b43304ba7dfb]::query::caches::DefIdCache<rustc_middle[9902b4682aa0495d]::query::erase::Erased<[u8; 16usize]>>, false, false, false>, rustc_query_impl[2236df548ee42a79]::plumbing::QueryCtxt, false>
  24:     0x7d0bb98ddea0 - rustc_query_impl[2236df548ee42a79]::query_impl::explicit_item_bounds::get_query_non_incr::__rust_end_short_backtrace
  25:     0x7d0bb9573008 - rustc_hir_analysis[97d869527a21e1a5]::check::compare_impl_item::check_type_bounds
  26:     0x7d0bb9650c98 - rustc_hir_analysis[97d869527a21e1a5]::check::check::check_item_type
  27:     0x7d0bb95f931a - rustc_hir_analysis[97d869527a21e1a5]::check::wfcheck::check_well_formed
  28:     0x7d0bb95f78eb - rustc_query_impl[2236df548ee42a79]::plumbing::__rust_begin_short_backtrace::<rustc_query_impl[2236df548ee42a79]::query_impl::check_well_formed::dynamic_query::{closure#2}::{closure#0}, rustc_middle[9902b4682aa0495d]::query::erase::Erased<[u8; 1usize]>>
  29:     0x7d0bb95f7194 - rustc_query_system[be2b43304ba7dfb]::query::plumbing::try_execute_query::<rustc_query_impl[2236df548ee42a79]::DynamicConfig<rustc_data_structures[2fd0664b6811e02d]::vec_cache::VecCache<rustc_span[85c7266a28769ec9]::def_id::LocalDefId, rustc_middle[9902b4682aa0495d]::query::erase::Erased<[u8; 1usize]>, rustc_query_system[be2b43304ba7dfb]::dep_graph::graph::DepNodeIndex>, false, false, false>, rustc_query_impl[2236df548ee42a79]::plumbing::QueryCtxt, false>
  30:     0x7d0bb95f6c83 - rustc_query_impl[2236df548ee42a79]::query_impl::check_well_formed::get_query_non_incr::__rust_end_short_backtrace
  31:     0x7d0bb95f30e5 - rustc_hir_analysis[97d869527a21e1a5]::check::wfcheck::check_mod_type_wf
  32:     0x7d0bb95f2edd - rustc_query_impl[2236df548ee42a79]::plumbing::__rust_begin_short_backtrace::<rustc_query_impl[2236df548ee42a79]::query_impl::check_mod_type_wf::dynamic_query::{closure#2}::{closure#0}, rustc_middle[9902b4682aa0495d]::query::erase::Erased<[u8; 1usize]>>
  33:     0x7d0bb9991999 - rustc_query_system[be2b43304ba7dfb]::query::plumbing::try_execute_query::<rustc_query_impl[2236df548ee42a79]::DynamicConfig<rustc_query_system[be2b43304ba7dfb]::query::caches::DefaultCache<rustc_span[85c7266a28769ec9]::def_id::LocalModDefId, rustc_middle[9902b4682aa0495d]::query::erase::Erased<[u8; 1usize]>>, false, false, false>, rustc_query_impl[2236df548ee42a79]::plumbing::QueryCtxt, false>
  34:     0x7d0bb9991710 - rustc_query_impl[2236df548ee42a79]::query_impl::check_mod_type_wf::get_query_non_incr::__rust_end_short_backtrace
  35:     0x7d0bb903ffe6 - rustc_hir_analysis[97d869527a21e1a5]::check_crate
  36:     0x7d0bb91d46f2 - rustc_interface[8c35278d6665784]::passes::run_required_analyses
  37:     0x7d0bb99a0dde - rustc_interface[8c35278d6665784]::passes::analysis
  38:     0x7d0bb99a0dad - rustc_query_impl[2236df548ee42a79]::plumbing::__rust_begin_short_backtrace::<rustc_query_impl[2236df548ee42a79]::query_impl::analysis::dynamic_query::{closure#2}::{closure#0}, rustc_middle[9902b4682aa0495d]::query::erase::Erased<[u8; 0usize]>>
  39:     0x7d0bb9e141bd - rustc_query_system[be2b43304ba7dfb]::query::plumbing::try_execute_query::<rustc_query_impl[2236df548ee42a79]::DynamicConfig<rustc_query_system[be2b43304ba7dfb]::query::caches::SingleCache<rustc_middle[9902b4682aa0495d]::query::erase::Erased<[u8; 0usize]>>, false, false, false>, rustc_query_impl[2236df548ee42a79]::plumbing::QueryCtxt, false>
  40:     0x7d0bb9e13eb8 - rustc_query_impl[2236df548ee42a79]::query_impl::analysis::get_query_non_incr::__rust_end_short_backtrace
  41:     0x7d0bb9cd223e - rustc_interface[8c35278d6665784]::passes::create_and_enter_global_ctxt::<core[58638a26b282635c]::option::Option<rustc_interface[8c35278d6665784]::queries::Linker>, rustc_driver_impl[5fbee50f607e217]::run_compiler::{closure#0}::{closure#2}>::{closure#2}::{closure#0}
  42:     0x7d0bb9f0acc4 - rustc_interface[8c35278d6665784]::interface::run_compiler::<(), rustc_driver_impl[5fbee50f607e217]::run_compiler::{closure#0}>::{closure#1}
  43:     0x7d0bb9cf36e8 - std[2ad6d0fee2e09edc]::sys::backtrace::__rust_begin_short_backtrace::<rustc_interface[8c35278d6665784]::util::run_in_thread_with_globals<rustc_interface[8c35278d6665784]::util::run_in_thread_pool_with_globals<rustc_interface[8c35278d6665784]::interface::run_compiler<(), rustc_driver_impl[5fbee50f607e217]::run_compiler::{closure#0}>::{closure#1}, ()>::{closure#0}, ()>::{closure#0}::{closure#0}, ()>
  44:     0x7d0bb9cf3ff4 - <<std[2ad6d0fee2e09edc]::thread::Builder>::spawn_unchecked_<rustc_interface[8c35278d6665784]::util::run_in_thread_with_globals<rustc_interface[8c35278d6665784]::util::run_in_thread_pool_with_globals<rustc_interface[8c35278d6665784]::interface::run_compiler<(), rustc_driver_impl[5fbee50f607e217]::run_compiler::{closure#0}>::{closure#1}, ()>::{closure#0}, ()>::{closure#0}::{closure#0}, ()>::{closure#1} as core[58638a26b282635c]::ops::function::FnOnce<()>>::call_once::{shim:vtable#0}
  45:     0x7d0bb9cf53f7 - std::sys::pal::unix::thread::Thread::new::thread_start::h7f6705cc982c7917
  46:     0x7d0bb3ca370a - <unknown>
  47:     0x7d0bb3d27aac - <unknown>
  48:                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 (78f2104e3 2025-04-16) running on x86_64-unknown-linux-gnu

query stack during panic:
#0 [explicit_item_bounds] finding item bounds for `Foo::{anon_assoc#0}`
#1 [check_well_formed] checking that `Foo` 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, E0658.
For more information about an error, try `rustc --explain E0601`.

@matthiaskrgr matthiaskrgr added C-bug Category: This is a bug. I-ICE Issue: The compiler panicked, giving an Internal Compilation Error (ICE) ❄️ T-compiler Relevant to the compiler team, which will review and decide on the PR/issue. labels Apr 16, 2025
@rustbot rustbot added the needs-triage This issue may need triage. Remove it if it has been sufficiently triaged. label Apr 16, 2025
@matthiaskrgr
Copy link
Member Author

cc @nnethercote

@compiler-errors compiler-errors self-assigned this Apr 17, 2025
@jieyouxu jieyouxu removed the needs-triage This issue may need triage. Remove it if it has been sufficiently triaged. label Apr 17, 2025
jieyouxu added a commit to jieyouxu/rust that referenced this issue Apr 21, 2025
Don't compute name of associated item if it's an RPITIT

Another simple fix for an RPITIT name ICE.

Fixes rust-lang#139941
Fixes rust-lang#140084

r? nnethercote
ChrisDenton added a commit to ChrisDenton/rust that referenced this issue Apr 21, 2025
Don't compute name of associated item if it's an RPITIT

Another simple fix for an RPITIT name ICE.

Fixes rust-lang#139941
Fixes rust-lang#140084

r? nnethercote
@bors bors closed this as completed in 32862fb Apr 22, 2025
rust-timer added a commit to rust-lang-ci/rust that referenced this issue Apr 22, 2025
Rollup merge of rust-lang#139981 - compiler-errors:name-2, r=nnethercote

Don't compute name of associated item if it's an RPITIT

Another simple fix for an RPITIT name ICE.

Fixes rust-lang#139941
Fixes rust-lang#140084

r? nnethercote
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
C-bug Category: This is a bug. I-ICE Issue: The compiler panicked, giving an Internal Compilation Error (ICE) ❄️ T-compiler Relevant to the compiler team, which will review and decide on the PR/issue.
Projects
None yet
Development

Successfully merging a pull request may close this issue.

4 participants