- Notifications
You must be signed in to change notification settings - Fork 13.9k
Open
Labels
C-bugCategory: This is a bug.Category: This is a bug.F-inherent_associated_types`#![feature(inherent_associated_types)]``#![feature(inherent_associated_types)]`I-ICEIssue: The compiler panicked, giving an Internal Compilation Error (ICE) ❄️Issue: The compiler panicked, giving an Internal Compilation Error (ICE) ❄️T-compilerRelevant to the compiler team, which will review and decide on the PR/issue.Relevant to the compiler team, which will review and decide on the PR/issue.
Description
snippet:
#![feature(inherent_associated_types)] struct Foo<T>(T); impl<'a> Foo<fn(&'a ())> { type Assoc = &mut Peekable<I>; } fn bar(_: for<'a> fn(Foo<fn(Foo<fn(&'a ())>::Assoc)>::Assoc)) {} pub fn main() {}
Version information
rustc 1.89.0-nightly (8a65ee082 2025-06-19) binary: rustc commit-hash: 8a65ee08296b36342bf7c3cdc15312ccbc357227 commit-date: 2025-06-19 host: x86_64-unknown-linux-gnu release: 1.89.0-nightly LLVM version: 20.1.7
Possibly related line of code:
rust/compiler/rustc_trait_selection/src/traits/project.rs
Lines 599 to 611 in 8a65ee0
); | |
} | |
match selcx.infcx.at(&cause, param_env).eq(DefineOpaqueTypes::Yes, impl_ty, self_ty) { | |
Ok(mut ok) => obligations.append(&mut ok.obligations), | |
Err(_) => { | |
tcx.dcx().span_bug( | |
cause.span, | |
format!("{self_ty:?} was equal to {impl_ty:?} during selection but now it is not"), | |
); | |
} | |
} | |
Command:
/home/matthias/.rustup/toolchains/master/bin/rustc -Zcrate-attr=feature(inherent_associated_types)
Program output
error[E0637]: `&` without an explicit lifetime name cannot be used here --> /tmp/icemaker_global_tempdir.i7gCAV0RIrd2/rustc_testrunner_tmpdir_reporting.UHeEfyVeQdiK/mvce.rs:4:18 | 4 | type Assoc = &mut Peekable<I>; | ^ explicit lifetime name needed here error[E0412]: cannot find type `Peekable` in this scope --> /tmp/icemaker_global_tempdir.i7gCAV0RIrd2/rustc_testrunner_tmpdir_reporting.UHeEfyVeQdiK/mvce.rs:4:23 | 4 | type Assoc = &mut Peekable<I>; | ^^^^^^^^ not found in this scope | help: consider importing this struct | 1 + use std::iter::Peekable; | error[E0412]: cannot find type `I` in this scope --> /tmp/icemaker_global_tempdir.i7gCAV0RIrd2/rustc_testrunner_tmpdir_reporting.UHeEfyVeQdiK/mvce.rs:4:32 | 4 | type Assoc = &mut Peekable<I>; | ^ not found in this scope | help: you might be missing a type parameter | 3 | impl<'a, I> Foo<fn(&'a ())> { | +++ warning: the feature `inherent_associated_types` is incomplete and may not be safe to use and/or cause compiler crashes --> <crate attribute>:1:12 | 1 | #![feature(inherent_associated_types)] | ^^^^^^^^^^^^^^^^^^^^^^^^^ | = note: see issue #8995 <https://github.com/rust-lang/rust/issues/8995> for more information = note: `#[warn(incomplete_features)]` on by default error[E0601]: `main` function not found in crate `mvce` --> /tmp/icemaker_global_tempdir.i7gCAV0RIrd2/rustc_testrunner_tmpdir_reporting.UHeEfyVeQdiK/mvce.rs:7:65 | 7 | fn bar(_: for<'a> fn(Foo<fn(Foo<fn(&'a ())>::Assoc)>::Assoc)) {} | ^ consider adding a `main` function to `/tmp/icemaker_global_tempdir.i7gCAV0RIrd2/rustc_testrunner_tmpdir_reporting.UHeEfyVeQdiK/mvce.rs` error: internal compiler error: Foo<Binder { value: fn(&'{region error} mut {type error}), bound_vars: [] }> was equal to Foo<Binder { value: fn(&'?1 ()), bound_vars: [] }> during selection but now it is not --> /tmp/icemaker_global_tempdir.i7gCAV0RIrd2/rustc_testrunner_tmpdir_reporting.UHeEfyVeQdiK/mvce.rs:7:11 | 7 | fn bar(_: for<'a> fn(Foo<fn(Foo<fn(&'a ())>::Assoc)>::Assoc)) {} | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ thread 'rustc' panicked at compiler/rustc_trait_selection/src/traits/project.rs:605:23: Box<dyn Any> stack backtrace: 0: 0x758dc0ae7d63 - <std::sys::backtrace::BacktraceLock::print::DisplayBacktrace as core::fmt::Display>::fmt::hddb5e99560778aed 1: 0x758dc1202c7f - core::fmt::write::h12c234f0edc7b706 2: 0x758dc0add8e3 - std::io::Write::write_fmt::h1c65d113e08eaaff 3: 0x758dc0ae7bc2 - std::sys::backtrace::BacktraceLock::print::h9652e925cb317248 4: 0x758dc0aeb6ba - std::panicking::default_hook::{{closure}}::h58c1e754bf819be3 5: 0x758dc0aeb23f - std::panicking::default_hook::hc5c32bd16ea0a105 6: 0x758dbfbdecc7 - std[cbbb60a5cfd7ff5b]::panicking::update_hook::<alloc[e39721c0a904e78d]::boxed::Box<rustc_driver_impl[8279e16dc5823618]::install_ice_hook::{closure#1}>>::{closure#0} 7: 0x758dc0aebf13 - std::panicking::rust_panic_with_hook::h87286a060ae3c579 8: 0x758dbfc1bf01 - std[cbbb60a5cfd7ff5b]::panicking::begin_panic::<rustc_errors[9915c3893ed9e801]::ExplicitBug>::{closure#0} 9: 0x758dbfc103a6 - std[cbbb60a5cfd7ff5b]::sys::backtrace::__rust_end_short_backtrace::<std[cbbb60a5cfd7ff5b]::panicking::begin_panic<rustc_errors[9915c3893ed9e801]::ExplicitBug>::{closure#0}, !> 10: 0x758dbfc10097 - std[cbbb60a5cfd7ff5b]::panicking::begin_panic::<rustc_errors[9915c3893ed9e801]::ExplicitBug> 11: 0x758dbfc25c51 - <rustc_errors[9915c3893ed9e801]::diagnostic::BugAbort as rustc_errors[9915c3893ed9e801]::diagnostic::EmissionGuarantee>::emit_producing_guarantee 12: 0x758dc0820320 - <rustc_errors[9915c3893ed9e801]::DiagCtxtHandle>::span_bug::<rustc_span[6b6fbcae0de9ce85]::span_encoding::Span, alloc[e39721c0a904e78d]::string::String> 13: 0x758dc0984aa8 - rustc_trait_selection[afbea2bae8dda0a8]::traits::project::compute_inherent_assoc_term_args 14: 0x758dc09a7397 - rustc_trait_selection[afbea2bae8dda0a8]::traits::project::normalize_inherent_projection 15: 0x758dc09a7249 - <rustc_trait_selection[afbea2bae8dda0a8]::traits::normalize::AssocTypeNormalizer>::normalize_inherent_projection::{closure#0} 16: 0x758dc14c1ff1 - <rustc_trait_selection[afbea2bae8dda0a8]::traits::normalize::AssocTypeNormalizer as rustc_type_ir[f425777cba5ad9d]::fold::TypeFolder<rustc_middle[93a0193236758a7b]::ty::context::TyCtxt>>::fold_ty 17: 0x758dc14bb714 - <&rustc_middle[93a0193236758a7b]::ty::list::RawList<(), rustc_middle[93a0193236758a7b]::ty::Ty> as rustc_type_ir[f425777cba5ad9d]::fold::TypeFoldable<rustc_middle[93a0193236758a7b]::ty::context::TyCtxt>>::fold_with::<rustc_trait_selection[afbea2bae8dda0a8]::traits::normalize::AssocTypeNormalizer> 18: 0x758dc14c0262 - <rustc_middle[93a0193236758a7b]::ty::Ty as rustc_type_ir[f425777cba5ad9d]::fold::TypeSuperFoldable<rustc_middle[93a0193236758a7b]::ty::context::TyCtxt>>::super_fold_with::<rustc_trait_selection[afbea2bae8dda0a8]::traits::normalize::AssocTypeNormalizer> 19: 0x758dc1780e81 - <rustc_hir_analysis[1a09115eb8831c21]::check::wfcheck::WfCheckingCtxt>::deeply_normalize::<rustc_middle[93a0193236758a7b]::ty::Ty> 20: 0x758dc17824f3 - rustc_hir_analysis[1a09115eb8831c21]::check::wfcheck::check_fn_or_method 21: 0x758dc19d0dce - rustc_hir_analysis[1a09115eb8831c21]::check::wfcheck::check_item_fn 22: 0x758dc19d4928 - rustc_hir_analysis[1a09115eb8831c21]::check::wfcheck::check_item 23: 0x758dc19cbcd9 - rustc_hir_analysis[1a09115eb8831c21]::check::wfcheck::check_well_formed 24: 0x758dc19cbb59 - rustc_query_impl[fbc74060fac8c140]::plumbing::__rust_begin_short_backtrace::<rustc_query_impl[fbc74060fac8c140]::query_impl::check_well_formed::dynamic_query::{closure#2}::{closure#0}, rustc_middle[93a0193236758a7b]::query::erase::Erased<[u8; 1usize]>> 25: 0x758dc19cb38d - rustc_query_system[f33ca17fd4fddce8]::query::plumbing::try_execute_query::<rustc_query_impl[fbc74060fac8c140]::DynamicConfig<rustc_data_structures[4ddca31ccfde7627]::vec_cache::VecCache<rustc_span[6b6fbcae0de9ce85]::def_id::LocalDefId, rustc_middle[93a0193236758a7b]::query::erase::Erased<[u8; 1usize]>, rustc_query_system[f33ca17fd4fddce8]::dep_graph::graph::DepNodeIndex>, false, false, false>, rustc_query_impl[fbc74060fac8c140]::plumbing::QueryCtxt, false> 26: 0x758dc19caec2 - rustc_query_impl[fbc74060fac8c140]::query_impl::check_well_formed::get_query_non_incr::__rust_end_short_backtrace 27: 0x758dc19c865f - rustc_hir_analysis[1a09115eb8831c21]::check::wfcheck::check_type_wf 28: 0x758dc19c856f - rustc_query_impl[fbc74060fac8c140]::plumbing::__rust_begin_short_backtrace::<rustc_query_impl[fbc74060fac8c140]::query_impl::check_type_wf::dynamic_query::{closure#2}::{closure#0}, rustc_middle[93a0193236758a7b]::query::erase::Erased<[u8; 1usize]>> 29: 0x758dc226fe88 - rustc_query_system[f33ca17fd4fddce8]::query::plumbing::try_execute_query::<rustc_query_impl[fbc74060fac8c140]::DynamicConfig<rustc_query_system[f33ca17fd4fddce8]::query::caches::SingleCache<rustc_middle[93a0193236758a7b]::query::erase::Erased<[u8; 1usize]>>, false, false, false>, rustc_query_impl[fbc74060fac8c140]::plumbing::QueryCtxt, false> 30: 0x758dc226fc82 - rustc_query_impl[fbc74060fac8c140]::query_impl::check_type_wf::get_query_non_incr::__rust_end_short_backtrace 31: 0x758dc144c0de - rustc_hir_analysis[1a09115eb8831c21]::check_crate 32: 0x758dc1c6fb59 - rustc_interface[c880869786bb6952]::passes::analysis 33: 0x758dc1c6f76d - rustc_query_impl[fbc74060fac8c140]::plumbing::__rust_begin_short_backtrace::<rustc_query_impl[fbc74060fac8c140]::query_impl::analysis::dynamic_query::{closure#2}::{closure#0}, rustc_middle[93a0193236758a7b]::query::erase::Erased<[u8; 0usize]>> 34: 0x758dc226994e - rustc_query_system[f33ca17fd4fddce8]::query::plumbing::try_execute_query::<rustc_query_impl[fbc74060fac8c140]::DynamicConfig<rustc_query_system[f33ca17fd4fddce8]::query::caches::SingleCache<rustc_middle[93a0193236758a7b]::query::erase::Erased<[u8; 0usize]>>, false, false, false>, rustc_query_impl[fbc74060fac8c140]::plumbing::QueryCtxt, false> 35: 0x758dc2269536 - rustc_query_impl[fbc74060fac8c140]::query_impl::analysis::get_query_non_incr::__rust_end_short_backtrace 36: 0x758dc24a5b56 - rustc_interface[c880869786bb6952]::passes::create_and_enter_global_ctxt::<core[26657d77fe39fc47]::option::Option<rustc_interface[c880869786bb6952]::queries::Linker>, rustc_driver_impl[8279e16dc5823618]::run_compiler::{closure#0}::{closure#2}>::{closure#2}::{closure#0} 37: 0x758dc2466aa3 - rustc_interface[c880869786bb6952]::interface::run_compiler::<(), rustc_driver_impl[8279e16dc5823618]::run_compiler::{closure#0}>::{closure#1} 38: 0x758dc2444278 - std[cbbb60a5cfd7ff5b]::sys::backtrace::__rust_begin_short_backtrace::<rustc_interface[c880869786bb6952]::util::run_in_thread_with_globals<rustc_interface[c880869786bb6952]::util::run_in_thread_pool_with_globals<rustc_interface[c880869786bb6952]::interface::run_compiler<(), rustc_driver_impl[8279e16dc5823618]::run_compiler::{closure#0}>::{closure#1}, ()>::{closure#0}, ()>::{closure#0}::{closure#0}, ()> 39: 0x758dc2443f56 - <<std[cbbb60a5cfd7ff5b]::thread::Builder>::spawn_unchecked_<rustc_interface[c880869786bb6952]::util::run_in_thread_with_globals<rustc_interface[c880869786bb6952]::util::run_in_thread_pool_with_globals<rustc_interface[c880869786bb6952]::interface::run_compiler<(), rustc_driver_impl[8279e16dc5823618]::run_compiler::{closure#0}>::{closure#1}, ()>::{closure#0}, ()>::{closure#0}::{closure#0}, ()>::{closure#1} as core[26657d77fe39fc47]::ops::function::FnOnce<()>>::call_once::{shim:vtable#0} 40: 0x758dc244253d - std::sys::pal::unix::thread::Thread::new::thread_start::h62db728285f9da4a 41: 0x758dbbea57eb - <unknown> 42: 0x758dbbf2918c - <unknown> 43: 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 make sure that you have updated to the latest nightly note: rustc 1.89.0-nightly (8a65ee082 2025-06-19) running on x86_64-unknown-linux-gnu note: compiler flags: -Z crate-attr=feature(inherent_associated_types) -Z dump-mir-dir=dir query stack during panic: #0 [check_well_formed] checking that `bar` is well-formed #1 [check_type_wf] checking that types are well-formed #2 [analysis] running analysis passes on this crate end of query stack error: aborting due to 5 previous errors; 1 warning emitted Some errors have detailed explanations: E0412, E0601, E0637. For more information about an error, try `rustc --explain E0412`.
@rustbot label +F-inherent_associated_types
Metadata
Metadata
Assignees
Labels
C-bugCategory: This is a bug.Category: This is a bug.F-inherent_associated_types`#![feature(inherent_associated_types)]``#![feature(inherent_associated_types)]`I-ICEIssue: The compiler panicked, giving an Internal Compilation Error (ICE) ❄️Issue: The compiler panicked, giving an Internal Compilation Error (ICE) ❄️T-compilerRelevant to the compiler team, which will review and decide on the PR/issue.Relevant to the compiler team, which will review and decide on the PR/issue.
Type
Projects
Status
To Do