[ICE]: `We do not expect to encounter 'Fresh' variables in the new solver`
Open
Nobody has claimed this yet.
C-bug
F-min_generic_const_args
I-ICE
needs-triage
T-compiler
WG-trait-system-refactor
- Dominant language
- Rust
- Stars
- 119k
- Forks
- 16.2k
- PR merge metrics
- PR metrics pending
Description
Code
// -Znext-solver=globally
#![feature(min_generic_const_args)]
trait Test {
const C: Self;
fn lower(&self) -> dyn Test<C = const {}>;
}
fn main() {}
Meta
rustc --version --verbose:
rustc 1.99.0-nightly (af3d95584 2026-07-09)
binary: rustc
commit-hash: af3d95584dbddcae597890340995509a7fb47a50
commit-date: 2026-07-09
host: x86_64-unknown-linux-gnu
release: 1.99.0-nightly
LLVM version: 22.1.8
Error output
warning: the feature `min_generic_const_args` is incomplete and may not be safe to use and/or cause compiler crashes
--> code.rs:1:12
|
1 | #![feature(min_generic_const_args)]
| ^^^^^^^^^^^^^^^^^^^^^^
|
= note: see issue #132980 <https://github.com/rust-lang/rust/issues/132980> for more information
= note: `#[warn(incomplete_features)]` on by default
error: use of trait associated const not defined as `type const`
--> code.rs:4:33
|
4 | fn lower(&self) -> dyn Test<C = const {}>;
| ^^^^^^^^^^^^
|
= note: the declaration in the trait must begin with `type const` not just `const` alone
error[E0038]: the trait `Test` is not dyn compatible
--> code.rs:4:24
|
4 | fn lower(&self) -> dyn Test<C = const {}>;
| ^^^^^^^^^^^^^^^^^^^^^^ `Test` is not dyn compatible
|
note: for a trait to be dyn compatible it needs to allow building a vtable
for more information, visit <https://doc.rust-lang.org/reference/items/traits.html#dyn-compatibility>
--> code.rs:3:11
|
2 | trait Test {
| ---- this trait is not dyn compatible...
3 | const C: Self;
| ^
| |
| ...because it contains associated const `C` that's not defined as `type const`
| ...because it contains associated const `C` whose type references the `Self` type
= help: consider moving `C` to another trait
help: you might have meant to use `Self` to refer to the implementing type
|
4 - fn lower(&self) -> dyn Test<C = const {}>;
4 + fn lower(&self) -> Self;
|
Backtrace
thread 'rustc' (2834876) panicked at /rustc-dev/31e4b8481fec5ae856d786ff3b75a5bccaf33725/compiler/rustc_type_ir/src/relate/combine.rs:114:13:
We do not expect to encounter `Fresh` variables in the new solver
stack backtrace:
0: 0x7fcfda3e3896 - <<std[e48f09884f45ea21]::sys::backtrace::BacktraceLock>::print::DisplayBacktrace as core[e5be8543f67d0d91]::fmt::Display>::fmt
1: 0x7fcfdaa0f048 - core[e5be8543f67d0d91]::fmt::write
2: 0x7fcfda3f8d0c - <std[e48f09884f45ea21]::sys::stdio::unix::Stderr as core[e5be8543f67d0d91]::io::write::Write>::write_fmt
3: 0x7fcfda3b7b7a - std[e48f09884f45ea21]::panicking::default_hook::{closure#0}
4: 0x7fcfda3d5f63 - std[e48f09884f45ea21]::panicking::default_hook
5: 0x7fcfd93ae0c8 - std[e48f09884f45ea21]::panicking::update_hook::<alloc[4dba938b21960414]::boxed::Box<rustc_driver_impl[534fa358d39ad0eb]::install_ice_hook::{closure#1}>>::{closure#0}
6: 0x7fcfda3d6402 - std[e48f09884f45ea21]::panicking::panic_with_hook
7: 0x7fcfda3b7c64 - std[e48f09884f45ea21]::panicking::panic_handler::{closure#0}
8: 0x7fcfda3ae8e9 - std[e48f09884f45ea21]::sys::backtrace::__rust_end_short_backtrace::<std[e48f09884f45ea21]::panicking::panic_handler::{closure#0}, !>
9: 0x7fcfda3b959d - __rustc[f7e22f5d7ccfbcc1]::rust_begin_unwind
10: 0x7fcfd717262c - core[e5be8543f67d0d91]::panicking::panic_fmt
11: 0x7fcfdb705f98 - <rustc_middle[7c2a401f29a14518]::ty::Ty as rustc_type_ir[689c3847c47c4160]::relate::Relate<rustc_middle[7c2a401f29a14518]::ty::context::TyCtxt>>::relate::<rustc_type_ir[689c3847c47c4160]::relate::solver_relating::SolverRelating<rustc_infer[6f31d3625ac9b1f8]::infer::InferCtxt, rustc_middle[7c2a401f29a14518]::ty::context::TyCtxt>>
12: 0x7fcfdb704beb - <rustc_infer[6f31d3625ac9b1f8]::infer::InferCtxt as rustc_type_ir[689c3847c47c4160]::relate::solver_relating::RelateExt>::relate::<rustc_middle[7c2a401f29a14518]::ty::Ty>
13: 0x7fcfdac8908f - <rustc_hir_typeck[7d7079933e194f47]::fn_ctxt::FnCtxt>::check_expr_block
14: 0x7fcfdac7cd20 - <rustc_hir_typeck[7d7079933e194f47]::fn_ctxt::FnCtxt>::check_expr_with_expectation_and_args
15: 0x7fcfdbcff18e - rustc_hir_typeck[7d7079933e194f47]::typeck_with_inspect::{closure#0}
16: 0x7fcfdbcfb0f0 - rustc_query_impl[3955d32c7988f865]::query_impl::typeck_root::invoke_provider_fn::__rust_begin_short_backtrace
17: 0x7fcfdafacc69 - rustc_query_impl[3955d32c7988f865]::execution::try_execute_query::<rustc_data_structures[a12274fc7e50345]::vec_cache::VecCache<rustc_span[9cc8f1799c8a1528]::def_id::LocalDefId, rustc_middle[7c2a401f29a14518]::query::erase::ErasedData<[u8; 8usize]>, rustc_middle[7c2a401f29a14518]::dep_graph::graph::DepNodeIndex>, false>
18: 0x7fcfdafac6c3 - rustc_query_impl[3955d32c7988f865]::query_impl::typeck_root::execute_query_non_incr::__rust_end_short_backtrace
19: 0x7fcfdae0ca77 - rustc_query_impl[3955d32c7988f865]::query_impl::used_trait_imports::invoke_provider_fn::__rust_begin_short_backtrace
20: 0x7fcfdafacc69 - rustc_query_impl[3955d32c7988f865]::execution::try_execute_query::<rustc_data_structures[a12274fc7e50345]::vec_cache::VecCache<rustc_span[9cc8f1799c8a1528]::def_id::LocalDefId, rustc_middle[7c2a401f29a14518]::query::erase::ErasedData<[u8; 8usize]>, rustc_middle[7c2a401f29a14518]::dep_graph::graph::DepNodeIndex>, false>
21: 0x7fcfdafac783 - rustc_query_impl[3955d32c7988f865]::query_impl::used_trait_imports::execute_query_non_incr::__rust_end_short_backtrace
22: 0x7fcfdafabf2b - rustc_hir_analysis[f9be9704020dacdd]::check_unused::check_unused_traits
23: 0x7fcfdbbf6787 - rustc_query_impl[3955d32c7988f865]::execution::try_execute_query::<rustc_middle[7c2a401f29a14518]::query::caches::SingleCache<rustc_middle[7c2a401f29a14518]::query::erase::ErasedData<[u8; 0usize]>>, false>
24: 0x7fcfdbbf656f - rustc_query_impl[3955d32c7988f865]::query_impl::check_unused_traits::execute_query_non_incr::__rust_end_short_backtrace
25: 0x7fcfdb20cde7 - rustc_hir_analysis[f9be9704020dacdd]::check_crate
26: 0x7fcfdafad97f - rustc_interface[4829d49cec04e530]::passes::analysis
27: 0x7fcfdbbf6787 - rustc_query_impl[3955d32c7988f865]::execution::try_execute_query::<rustc_middle[7c2a401f29a14518]::query::caches::SingleCache<rustc_middle[7c2a401f29a14518]::query::erase::ErasedData<[u8; 0usize]>>, false>
28: 0x7fcfdbbf647f - rustc_query_impl[3955d32c7988f865]::query_impl::analysis::execute_query_non_incr::__rust_end_short_backtrace
29: 0x7fcfdbb87ac9 - rustc_interface[4829d49cec04e530]::interface::run_compiler::<(), rustc_driver_impl[534fa358d39ad0eb]::run_compiler::{closure#0}>::{closure#1}
30: 0x7fcfdbbe853a - std[e48f09884f45ea21]::sys::backtrace::__rust_begin_short_backtrace::<rustc_interface[4829d49cec04e530]::util::run_in_thread_with_globals<rustc_interface[4829d49cec04e530]::util::run_in_thread_pool_with_globals<rustc_interface[4829d49cec04e530]::interface::run_compiler<(), rustc_driver_impl[534fa358d39ad0eb]::run_compiler::{closure#0}>::{closure#1}, ()>::{closure#0}, ()>::{closure#0}::{closure#0}, ()>
31: 0x7fcfdbbe82ed - <std[e48f09884f45ea21]::thread::lifecycle::spawn_unchecked<rustc_interface[4829d49cec04e530]::util::run_in_thread_with_globals<rustc_interface[4829d49cec04e530]::util::run_in_thread_pool_with_globals<rustc_interface[4829d49cec04e530]::interface::run_compiler<(), rustc_driver_impl[534fa358d39ad0eb]::run_compiler::{closure#0}>::{closure#1}, ()>::{closure#0}, ()>::{closure#0}::{closure#0}, ()>::{closure#1} as core[e5be8543f67d0d91]::ops::function::FnOnce<()>>::call_once::{shim:vtable#0}
32: 0x7fcfdbbde07a - <std[e48f09884f45ea21]::sys::thread::unix::Thread>::new::thread_start
33: 0x7fcfd54981b9 - <unknown>
34: 0x7fcfd551d21c - <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: please attach the file at `/home/matthias/vcs/github/CRED/rustc-ice-2026-07-10T17_20_30-2834874.txt` to your bug report
note: rustc 1.99.0-nightly (31e4b8481 2026-07-10) running on x86_64-unknown-linux-gnu
note: compiler flags: -Z next-solver=globally
query stack during panic:
#0 [typeck_root] type-checking `Test::lower::{constant#0}::{constant#0}`
#1 [used_trait_imports] finding used_trait_imports `Test::lower::{constant#0}::{constant#0}`
#2 [check_unused_traits] checking unused trait imports in crate
#3 [analysis] running analysis passes on crate `code`
end of query stack
error: aborting due to 2 previous errors; 1 warning emitted
For more information about this error, try `rustc --explain E0038`.
Contributor guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
Reproduce the provided code with -Znext-solver=globally and compare the diagnostic path with the backtrace. Start in compiler/rustc_type_ir/src/relate/combine.rs at the Fresh variable panic, then trace the rustc_hir_typeck::fn_ctxt::FnCtxt::check_expr_block entry point. Done means the example no longer triggers an internal compiler error while its normal diagnostics remain available.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- rust
- Domain
- compilers
- Issue type
- Bug
- Difficulty
- 4/5
- Estimated time
- 3-5 days
- Activity status
- Quiet
- Clarity
- Mostly clear
- Newbie friendliness
- 48/100