-
-
Notifications
You must be signed in to change notification settings - Fork 14.5k
Closed
Labels
C-bugCategory: This is a bug.Category: This is a bug.F-associated_type_defaults`#![feature(associated_type_defaults)]``#![feature(associated_type_defaults)]`I-ICEIssue: The compiler panicked, giving an Internal Compilation Error (ICE) ❄️Issue: The compiler panicked, giving an Internal Compilation Error (ICE) ❄️S-has-bisectionStatus: A bisection has been found for this issueStatus: A bisection has been found for this issueT-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.WG-trait-system-refactorThe Rustc Trait System Refactor Initiative (-Znext-solver)The Rustc Trait System Refactor Initiative (-Znext-solver)
Description
auto-reduced (treereduce-rust):
//@compile-flags: -Znext-solver=globally
trait Foo {
type Assoc<T = u8> = T;
}
impl Foo for () {
fn foo() -> Self::Assoc {
[]
}
}original:
#![feature(associated_type_defaults)]
trait Foo {
type Assoc<T = u8> = T;
fn foo() -> Self::Assoc;
}
impl Foo for () {
fn foo() -> Self::Assoc {
[]
}
}
fn main() {}Version information
rustc 1.95.0-nightly (873b4beb0 2026-02-15)
binary: rustc
commit-hash: 873b4beb0cc726493b94c8ef21f68795c04fbbc1
commit-date: 2026-02-15
host: x86_64-unknown-linux-gnu
release: 1.95.0-nightly
LLVM version: 22.1.0
Possibly related line of code:
rust/compiler/rustc_type_ir/src/binder.rs
Lines 787 to 799 in 873b4be
| ) | |
| } | |
| #[cold] | |
| #[inline(never)] | |
| fn type_param_out_of_range(&self, p: I::ParamTy, ty: I::Ty) -> ! { | |
| panic!( | |
| "type parameter `{:?}` ({:?}/{}) out of range when instantiating, args={:?}", | |
| p, | |
| ty, | |
| p.index(), | |
| self.args, | |
| ) |
Command:
/home/matthias/.rustup/toolchains/master/bin/rustc -Znext-solver=globally
Program output
error[E0407]: method `foo` is not a member of trait `Foo`
--> /tmp/icemaker_global_tempdir.2doDOVLulfVW/rustc_testrunner_tmpdir_reporting.oyhEhYHavQgQ/mvce.rs:5:5
|
5 | / fn foo() -> Self::Assoc {
6 | | []
7 | | }
| |_____^ not a member of trait `Foo`
error[E0658]: associated type defaults are unstable
--> /tmp/icemaker_global_tempdir.2doDOVLulfVW/rustc_testrunner_tmpdir_reporting.oyhEhYHavQgQ/mvce.rs:2:5
|
2 | type Assoc<T = u8> = T;
| ^^^^^^^^^^^^^^^^^^^^^^^
|
= note: see issue #29661 <https://github.com/rust-lang/rust/issues/29661> for more information
= help: add `#![feature(associated_type_defaults)]` to the crate attributes to enable
= note: this compiler was built on 2026-02-15; consider upgrading it if it is out of date
error[E0601]: `main` function not found in crate `mvce`
--> /tmp/icemaker_global_tempdir.2doDOVLulfVW/rustc_testrunner_tmpdir_reporting.oyhEhYHavQgQ/mvce.rs:8:2
|
8 | }
| ^ consider adding a `main` function to `/tmp/icemaker_global_tempdir.2doDOVLulfVW/rustc_testrunner_tmpdir_reporting.oyhEhYHavQgQ/mvce.rs`
error: defaults for generic parameters are not allowed here
--> /tmp/icemaker_global_tempdir.2doDOVLulfVW/rustc_testrunner_tmpdir_reporting.oyhEhYHavQgQ/mvce.rs:2:16
|
2 | type Assoc<T = u8> = T;
| ^^^^^^
thread 'rustc' (706425) panicked at /rustc-dev/873b4beb0cc726493b94c8ef21f68795c04fbbc1/compiler/rustc_type_ir/src/binder.rs:793:9:
type parameter `T/#1` (T/#1/1) out of range when instantiating, args=[u8]
stack backtrace:
0: 0x7f73a29d449b - <<std[e84040df3bd3b365]::sys::backtrace::BacktraceLock>::print::DisplayBacktrace as core[6c6f0f72ed298c38]::fmt::Display>::fmt
1: 0x7f73a30110e0 - core[6c6f0f72ed298c38]::fmt::write
2: 0x7f73a29eb716 - <std[e84040df3bd3b365]::sys::stdio::unix::Stderr as std[e84040df3bd3b365]::io::Write>::write_fmt
3: 0x7f73a29aa548 - std[e84040df3bd3b365]::panicking::default_hook::{closure#0}
4: 0x7f73a29c7903 - std[e84040df3bd3b365]::panicking::default_hook
5: 0x7f73a1990f8f - std[e84040df3bd3b365]::panicking::update_hook::<alloc[d9717d1773e7bcdb]::boxed::Box<rustc_driver_impl[1d3373f79f63c38d]::install_ice_hook::{closure#1}>>::{closure#0}
6: 0x7f73a29c7be2 - std[e84040df3bd3b365]::panicking::panic_with_hook
7: 0x7f73a29aa608 - std[e84040df3bd3b365]::panicking::panic_handler::{closure#0}
8: 0x7f73a29a1359 - std[e84040df3bd3b365]::sys::backtrace::__rust_end_short_backtrace::<std[e84040df3bd3b365]::panicking::panic_handler::{closure#0}, !>
9: 0x7f73a29ac06d - __rustc[d6e935dc4dcc4704]::rust_begin_unwind
10: 0x7f739f6717ec - core[6c6f0f72ed298c38]::panicking::panic_fmt
11: 0x7f73a1fbcff5 - <rustc_type_ir[275375aa126ff558]::binder::ArgFolder<rustc_middle[11be9ef6dd95cb79]::ty::context::TyCtxt>>::type_param_out_of_range
12: 0x7f73a303f310 - <rustc_type_ir[275375aa126ff558]::binder::ArgFolder<rustc_middle[11be9ef6dd95cb79]::ty::context::TyCtxt> as rustc_type_ir[275375aa126ff558]::fold::TypeFolder<rustc_middle[11be9ef6dd95cb79]::ty::context::TyCtxt>>::fold_ty
13: 0x7f73a500a5bf - <rustc_type_ir[275375aa126ff558]::binder::EarlyBinder<rustc_middle[11be9ef6dd95cb79]::ty::context::TyCtxt, rustc_middle[11be9ef6dd95cb79]::ty::Ty>>::instantiate::<&rustc_middle[11be9ef6dd95cb79]::ty::list::RawList<(), rustc_middle[11be9ef6dd95cb79]::ty::generic_args::GenericArg>>.cold
14: 0x7f73a010e2c0 - <rustc_trait_selection[df9ef241cd28f90b]::error_reporting::TypeErrCtxt>::report_mismatched_types
15: 0x7f73a11232b3 - <rustc_hir_typeck[2234c10747a7efa7]::coercion::CoerceMany>::report_return_mismatched_types
16: 0x7f73a35b4d5b - <rustc_hir_typeck[2234c10747a7efa7]::fn_ctxt::FnCtxt>::check_expr_block
17: 0x7f73a35ad757 - <rustc_hir_typeck[2234c10747a7efa7]::fn_ctxt::FnCtxt>::check_expr_with_expectation_and_args
18: 0x7f73a3575e90 - rustc_hir_typeck[2234c10747a7efa7]::check::check_fn
19: 0x7f73a3d7e91f - rustc_hir_typeck[2234c10747a7efa7]::typeck_with_inspect::{closure#0}
20: 0x7f73a3d7d2f2 - rustc_query_impl[761ff2116f6b567]::query_impl::typeck::invoke_provider_fn::__rust_begin_short_backtrace
21: 0x7f73a3a450fe - rustc_query_impl[761ff2116f6b567]::execution::try_execute_query::<rustc_data_structures[be2354717932db16]::vec_cache::VecCache<rustc_span[8943e0009ed5ffe4]::def_id::LocalDefId, rustc_middle[11be9ef6dd95cb79]::query::erase::ErasedData<[u8; 8usize]>, rustc_middle[11be9ef6dd95cb79]::dep_graph::graph::DepNodeIndex>, {rustc_query_impl[761ff2116f6b567]::QueryFlags { is_anon: false, is_depth_limit: false, is_feedable: false }}, false>
22: 0x7f73a3a44cc9 - rustc_query_impl[761ff2116f6b567]::query_impl::typeck::get_query_non_incr::__rust_end_short_backtrace
23: 0x7f73a3a3e608 - <rustc_middle[11be9ef6dd95cb79]::ty::context::TyCtxt>::par_hir_body_owners::<rustc_hir_analysis[21cab81ddb5349c4]::check_crate::{closure#2}>::{closure#0}
24: 0x7f73a3a3e02e - rustc_hir_analysis[21cab81ddb5349c4]::check_crate
25: 0x7f73a3a41c96 - rustc_interface[ffa26b8aee337d6b]::passes::analysis
26: 0x7f73a4269a19 - rustc_query_impl[761ff2116f6b567]::execution::try_execute_query::<rustc_middle[11be9ef6dd95cb79]::query::caches::SingleCache<rustc_middle[11be9ef6dd95cb79]::query::erase::ErasedData<[u8; 0usize]>>, {rustc_query_impl[761ff2116f6b567]::QueryFlags { is_anon: false, is_depth_limit: false, is_feedable: false }}, false>
27: 0x7f73a4269754 - rustc_query_impl[761ff2116f6b567]::query_impl::analysis::get_query_non_incr::__rust_end_short_backtrace
28: 0x7f73a433a667 - <rustc_interface[ffa26b8aee337d6b]::passes::create_and_enter_global_ctxt<core[6c6f0f72ed298c38]::option::Option<rustc_interface[ffa26b8aee337d6b]::queries::Linker>, rustc_driver_impl[1d3373f79f63c38d]::run_compiler::{closure#0}::{closure#2}>::{closure#2} as core[6c6f0f72ed298c38]::ops::function::FnOnce<(&rustc_session[e077b3088d2cab4d]::session::Session, rustc_middle[11be9ef6dd95cb79]::ty::context::CurrentGcx, alloc[d9717d1773e7bcdb]::sync::Arc<rustc_data_structures[be2354717932db16]::jobserver::Proxy>, &std[e84040df3bd3b365]::sync::once_lock::OnceLock<rustc_middle[11be9ef6dd95cb79]::ty::context::GlobalCtxt>, &rustc_data_structures[be2354717932db16]::sync::worker_local::WorkerLocal<rustc_middle[11be9ef6dd95cb79]::arena::Arena>, &rustc_data_structures[be2354717932db16]::sync::worker_local::WorkerLocal<rustc_hir[e6f1d3e8b67d381c]::Arena>, rustc_driver_impl[1d3373f79f63c38d]::run_compiler::{closure#0}::{closure#2})>>::call_once::{shim:vtable#0}
29: 0x7f73a4247ad0 - rustc_interface[ffa26b8aee337d6b]::interface::run_compiler::<(), rustc_driver_impl[1d3373f79f63c38d]::run_compiler::{closure#0}>::{closure#1}
30: 0x7f73a42307be - std[e84040df3bd3b365]::sys::backtrace::__rust_begin_short_backtrace::<rustc_interface[ffa26b8aee337d6b]::util::run_in_thread_with_globals<rustc_interface[ffa26b8aee337d6b]::util::run_in_thread_pool_with_globals<rustc_interface[ffa26b8aee337d6b]::interface::run_compiler<(), rustc_driver_impl[1d3373f79f63c38d]::run_compiler::{closure#0}>::{closure#1}, ()>::{closure#0}, ()>::{closure#0}::{closure#0}, ()>
31: 0x7f73a4230ea0 - <std[e84040df3bd3b365]::thread::lifecycle::spawn_unchecked<rustc_interface[ffa26b8aee337d6b]::util::run_in_thread_with_globals<rustc_interface[ffa26b8aee337d6b]::util::run_in_thread_pool_with_globals<rustc_interface[ffa26b8aee337d6b]::interface::run_compiler<(), rustc_driver_impl[1d3373f79f63c38d]::run_compiler::{closure#0}>::{closure#1}, ()>::{closure#0}, ()>::{closure#0}::{closure#0}, ()>::{closure#1} as core[6c6f0f72ed298c38]::ops::function::FnOnce<()>>::call_once::{shim:vtable#0}
32: 0x7f73a4231d2c - <std[e84040df3bd3b365]::sys::thread::unix::Thread>::new::thread_start
33: 0x7f73a5ab598b - <unknown>
34: 0x7f73a5b39a0c - <unknown>
35: 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.95.0-nightly (873b4beb0 2026-02-15) running on x86_64-unknown-linux-gnu
note: compiler flags: -Z next-solver=globally -Z dump-mir-dir=dir
query stack during panic:
#0 [typeck] type-checking `<impl at /tmp/icemaker_global_tempdir.2doDOVLulfVW/rustc_testrunner_tmpdir_reporting.oyhEhYHavQgQ/mvce.rs:4:1: 4:16>::foo`
#1 [analysis] running analysis passes on crate `mvce`
end of query stack
error: aborting due to 4 previous errors
Some errors have detailed explanations: E0407, E0601, E0658.
For more information about an error, try `rustc --explain E0407`.
@rustbot label +F-associated_type_defaults +WG-trait-system-refactor
Reactions are currently unavailable
Metadata
Metadata
Assignees
Labels
C-bugCategory: This is a bug.Category: This is a bug.F-associated_type_defaults`#![feature(associated_type_defaults)]``#![feature(associated_type_defaults)]`I-ICEIssue: The compiler panicked, giving an Internal Compilation Error (ICE) ❄️Issue: The compiler panicked, giving an Internal Compilation Error (ICE) ❄️S-has-bisectionStatus: A bisection has been found for this issueStatus: A bisection has been found for this issueT-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.WG-trait-system-refactorThe Rustc Trait System Refactor Initiative (-Znext-solver)The Rustc Trait System Refactor Initiative (-Znext-solver)