Skip to content

ICE unexpected region #143896

@matthiaskrgr

Description

@matthiaskrgr

auto-reduced (treereduce-rust):

pub trait TraitA<'a> { const K: u8 = 0; } pub trait TraitB<T> {} impl<T> TraitA<T> for () {} impl<T> TraitB<T> for () where (): TraitA<T, K = 0> {}

original:

// The impl of lint `const_evaluatable_unchecked` used to wrongly assume and `assert!` that // successfully evaluating a type-system constant that has non-region args had to be an anon const. // In the case below however we have a type-system assoc const (here: `<() as TraitA<T>>::K`). // // issue: <https://github.com/rust-lang/rust/issues/108220> //@ check-pass #![feature(associated_const_equality)] pub trait TraitA<'a> { const K: u8 = 0; } pub trait TraitB<T> {} impl<T> TraitA<T> for () {} impl<T> TraitB<T> for () where (): TraitA<T, K = 0> {} fn check<T>() where (): TraitB<T> {} fn main() {}

Version information

rustc 1.90.0-nightly (0fb279be1 2025-07-13) binary: rustc commit-hash: 0fb279be1d96464c69209053ef0f97ad63088cda commit-date: 2025-07-13 host: x86_64-unknown-linux-gnu release: 1.90.0-nightly LLVM version: 20.1.7 
Program output

error[E0726]: implicit elided lifetime not allowed here --> /tmp/icemaker_global_tempdir.ttIYrYCPM7Xu/rustc_testrunner_tmpdir_reporting.btX7oW3u9Dsn/mvce.rs:8:9 | 8 | impl<T> TraitA<T> for () {} | ^^^^^^^^^ expected lifetime parameter | help: indicate the anonymous lifetime | 8 | impl<T> TraitA<'_, T> for () {} | +++ error[E0106]: missing lifetime specifier --> /tmp/icemaker_global_tempdir.ttIYrYCPM7Xu/rustc_testrunner_tmpdir_reporting.btX7oW3u9Dsn/mvce.rs:9:42 | 9 | impl<T> TraitB<T> for () where (): TraitA<T, K = 0> {} | ^ expected named lifetime parameter | = note: for more information on higher-ranked polymorphism, visit https://doc.rust-lang.org/nomicon/hrtb.html help: consider making the bound lifetime-generic with a new `'a` lifetime | 9 | impl<T> TraitB<T> for () where (): for<'a> TraitA<'a, T, K = 0> {} | +++++++ +++ help: consider making the bound lifetime-generic with a new `'a` lifetime | 9 | impl<T> TraitB<T> for () where for<'a> (): TraitA<'a, T, K = 0> {} | +++++++ +++ help: consider introducing a named lifetime parameter | 9 | impl<'a, T> TraitB<T> for () where (): TraitA<'a, T, K = 0> {} | +++ +++ error[E0658]: associated const equality is incomplete --> /tmp/icemaker_global_tempdir.ttIYrYCPM7Xu/rustc_testrunner_tmpdir_reporting.btX7oW3u9Dsn/mvce.rs:9:46 | 9 | impl<T> TraitB<T> for () where (): TraitA<T, K = 0> {} | ^^^^^ | = note: see issue #92827 <https://github.com/rust-lang/rust/issues/92827> for more information = help: add `#![feature(associated_const_equality)]` to the crate attributes to enable = note: this compiler was built on 2025-07-13; consider upgrading it if it is out of date error[E0601]: `main` function not found in crate `mvce` --> /tmp/icemaker_global_tempdir.ttIYrYCPM7Xu/rustc_testrunner_tmpdir_reporting.btX7oW3u9Dsn/mvce.rs:9:55 | 9 | impl<T> TraitB<T> for () where (): TraitA<T, K = 0> {} | ^ consider adding a `main` function to `/tmp/icemaker_global_tempdir.ttIYrYCPM7Xu/rustc_testrunner_tmpdir_reporting.btX7oW3u9Dsn/mvce.rs` error[E0107]: trait takes 0 generic arguments but 1 generic argument was supplied --> /tmp/icemaker_global_tempdir.ttIYrYCPM7Xu/rustc_testrunner_tmpdir_reporting.btX7oW3u9Dsn/mvce.rs:8:9 | 8 | impl<T> TraitA<T> for () {} | ^^^^^^ - help: remove the unnecessary generic argument | | | expected 0 generic arguments | note: trait defined here, with 0 generic parameters --> /tmp/icemaker_global_tempdir.ttIYrYCPM7Xu/rustc_testrunner_tmpdir_reporting.btX7oW3u9Dsn/mvce.rs:3:11 | 3 | pub trait TraitA<'a> { | ^^^^^^ error[E0107]: trait takes 0 generic arguments but 1 generic argument was supplied --> /tmp/icemaker_global_tempdir.ttIYrYCPM7Xu/rustc_testrunner_tmpdir_reporting.btX7oW3u9Dsn/mvce.rs:9:36 | 9 | impl<T> TraitB<T> for () where (): TraitA<T, K = 0> {} | ^^^^^^ - help: remove the unnecessary generic argument | | | expected 0 generic arguments | note: trait defined here, with 0 generic parameters --> /tmp/icemaker_global_tempdir.ttIYrYCPM7Xu/rustc_testrunner_tmpdir_reporting.btX7oW3u9Dsn/mvce.rs:3:11 | 3 | pub trait TraitA<'a> { | ^^^^^^ thread 'rustc' panicked at /rustc-dev/0fb279be1d96464c69209053ef0f97ad63088cda/compiler/rustc_type_ir/src/binder.rs:703:29: unexpected region: '?0 stack backtrace: 0: 0x7826cb1b3653 - <std::sys::backtrace::BacktraceLock::print::DisplayBacktrace as core::fmt::Display>::fmt::h7777586ff18774f6 1: 0x7826cba02637 - core::fmt::write::h1e446913e38988b2 2: 0x7826cb1a9293 - std::io::Write::write_fmt::hb85a166e03cdc59a 3: 0x7826cb1b34b2 - std::sys::backtrace::BacktraceLock::print::h1893c0f2cdae29cf 4: 0x7826cb1b6f57 - std::panicking::default_hook::{{closure}}::h9efee442d7c704ab 5: 0x7826cb1b6abb - std::panicking::default_hook::h2d56912c25acf0ae 6: 0x7826ca256a63 - std[ad4a270f57f76841]::panicking::update_hook::<alloc[706ff5dcc87d2e8b]::boxed::Box<rustc_driver_impl[55fe545c67ec0c63]::install_ice_hook::{closure#1}>>::{closure#0} 7: 0x7826cb1b779e - std::panicking::rust_panic_with_hook::h358dfb9a3f7b81a2 8: 0x7826cb1b749a - std::panicking::begin_panic_handler::{{closure}}::h7b048792dfbf5a48 9: 0x7826cb1b3b29 - std::sys::backtrace::__rust_end_short_backtrace::h24ac9edaafcdfabe 10: 0x7826cb1b717d - __rustc[f1da5ef984f60a8d]::rust_begin_unwind 11: 0x7826c78e5880 - core::panicking::panic_fmt::h11e8cd77b1b5adc5 12: 0x7826cba933f3 - <&rustc_middle[cb45d0df77280ce6]::ty::list::RawList<(), rustc_middle[cb45d0df77280ce6]::ty::generic_args::GenericArg> as rustc_type_ir[35ffe6b17a358b46]::fold::TypeFoldable<rustc_middle[cb45d0df77280ce6]::ty::context::TyCtxt>>::fold_with::<rustc_type_ir[35ffe6b17a358b46]::binder::ArgFolder<rustc_middle[cb45d0df77280ce6]::ty::context::TyCtxt>> 13: 0x7826cd8a8609 - <rustc_type_ir[35ffe6b17a358b46]::binder::ArgFolder<rustc_middle[cb45d0df77280ce6]::ty::context::TyCtxt> as rustc_type_ir[35ffe6b17a358b46]::fold::TypeFolder<rustc_middle[cb45d0df77280ce6]::ty::context::TyCtxt>>::fold_const.cold 14: 0x7826cbcf7b34 - rustc_trait_selection[62f07d7f777572ba]::traits::project::confirm_candidate 15: 0x7826cbce7132 - rustc_trait_selection[62f07d7f777572ba]::traits::project::opt_normalize_projection_term 16: 0x7826cbce48bf - <rustc_infer[151add1b10804075]::infer::InferCtxt>::commit_if_ok::<rustc_trait_selection[62f07d7f777572ba]::traits::project::ProjectAndUnifyResult, rustc_infer[151add1b10804075]::traits::project::MismatchedProjectionTypes, rustc_trait_selection[62f07d7f777572ba]::traits::project::poly_project_and_unify_term::{closure#0}> 17: 0x7826cc2be9a7 - <rustc_trait_selection[62f07d7f777572ba]::traits::select::SelectionContext>::evaluate_root_obligation 18: 0x7826cc2bc3ab - rustc_traits[254a722a3ba79af5]::evaluate_obligation::evaluate_obligation 19: 0x7826cc2bbcff - rustc_query_impl[68e29cbc99db261f]::plumbing::__rust_begin_short_backtrace::<rustc_query_impl[68e29cbc99db261f]::query_impl::evaluate_obligation::dynamic_query::{closure#2}::{closure#0}, rustc_middle[cb45d0df77280ce6]::query::erase::Erased<[u8; 2usize]>> 20: 0x7826cc1e1550 - rustc_query_system[f234442582e7790a]::query::plumbing::try_execute_query::<rustc_query_impl[68e29cbc99db261f]::DynamicConfig<rustc_query_system[f234442582e7790a]::query::caches::DefaultCache<rustc_type_ir[35ffe6b17a358b46]::canonical::CanonicalQueryInput<rustc_middle[cb45d0df77280ce6]::ty::context::TyCtxt, rustc_middle[cb45d0df77280ce6]::ty::ParamEnvAnd<rustc_middle[cb45d0df77280ce6]::ty::predicate::Predicate>>, rustc_middle[cb45d0df77280ce6]::query::erase::Erased<[u8; 2usize]>>, false, false, false>, rustc_query_impl[68e29cbc99db261f]::plumbing::QueryCtxt, true> 21: 0x7826cbb63205 - rustc_query_impl[68e29cbc99db261f]::query_impl::evaluate_obligation::get_query_incr::__rust_end_short_backtrace 22: 0x7826cc06fe2e - <rustc_infer[151add1b10804075]::infer::InferCtxt as rustc_trait_selection[62f07d7f777572ba]::traits::query::evaluate_obligation::InferCtxtExt>::evaluate_obligation_no_overflow 23: 0x7826cc3c4384 - <rustc_trait_selection[62f07d7f777572ba]::traits::fulfill::FulfillProcessor as rustc_data_structures[6d8848fd01884538]::obligation_forest::ObligationProcessor>::process_obligation 24: 0x7826cba056c2 - <rustc_data_structures[6d8848fd01884538]::obligation_forest::ObligationForest<rustc_trait_selection[62f07d7f777572ba]::traits::fulfill::PendingPredicateObligation>>::process_obligations::<rustc_trait_selection[62f07d7f777572ba]::traits::fulfill::FulfillProcessor> 25: 0x7826cc393ced - <rustc_trait_selection[62f07d7f777572ba]::traits::fulfill::FulfillmentContext<rustc_trait_selection[62f07d7f777572ba]::traits::FulfillmentError> as rustc_infer[151add1b10804075]::traits::engine::TraitEngine<rustc_trait_selection[62f07d7f777572ba]::traits::FulfillmentError>>::select_all_or_error 26: 0x7826cc333f27 - rustc_hir_analysis[6cd5ab551d9a9249]::check::check::check_item_type 27: 0x7826cc3320b5 - rustc_hir_analysis[6cd5ab551d9a9249]::check::wfcheck::check_well_formed 28: 0x7826cc332097 - rustc_query_impl[68e29cbc99db261f]::plumbing::__rust_begin_short_backtrace::<rustc_query_impl[68e29cbc99db261f]::query_impl::check_well_formed::dynamic_query::{closure#2}::{closure#0}, rustc_middle[cb45d0df77280ce6]::query::erase::Erased<[u8; 1usize]>> 29: 0x7826cbf3641d - rustc_query_system[f234442582e7790a]::query::plumbing::try_execute_query::<rustc_query_impl[68e29cbc99db261f]::DynamicConfig<rustc_data_structures[6d8848fd01884538]::vec_cache::VecCache<rustc_span[a5d23146c59d8fe6]::def_id::LocalDefId, rustc_middle[cb45d0df77280ce6]::query::erase::Erased<[u8; 1usize]>, rustc_query_system[f234442582e7790a]::dep_graph::graph::DepNodeIndex>, false, false, false>, rustc_query_impl[68e29cbc99db261f]::plumbing::QueryCtxt, true> 30: 0x7826cbb64777 - rustc_query_impl[68e29cbc99db261f]::query_impl::check_well_formed::get_query_incr::__rust_end_short_backtrace 31: 0x7826ca3603ab - rustc_middle[cb45d0df77280ce6]::query::plumbing::query_ensure_error_guaranteed::<rustc_data_structures[6d8848fd01884538]::vec_cache::VecCache<rustc_span[a5d23146c59d8fe6]::def_id::LocalDefId, rustc_middle[cb45d0df77280ce6]::query::erase::Erased<[u8; 1usize]>, rustc_query_system[f234442582e7790a]::dep_graph::graph::DepNodeIndex>, ()> 32: 0x7826ca36df6f - rustc_data_structures[6d8848fd01884538]::sync::parallel::par_slice::par_rec::<&rustc_hir[47eeccf0a522356c]::hir::ItemId, rustc_data_structures[6d8848fd01884538]::sync::parallel::try_par_for_each_in<&[rustc_hir[47eeccf0a522356c]::hir::ItemId], rustc_span[a5d23146c59d8fe6]::ErrorGuaranteed, <rustc_middle[cb45d0df77280ce6]::hir::ModuleItems>::par_items<rustc_hir_analysis[6cd5ab551d9a9249]::check::wfcheck::check_type_wf::{closure#0}>::{closure#0}>::{closure#0}::{closure#0}> 33: 0x7826ca3d5127 - <rustc_thread_pool[507d1c80f68b01b9]::job::StackJob<rustc_thread_pool[507d1c80f68b01b9]::latch::SpinLatch, rustc_thread_pool[507d1c80f68b01b9]::join::join_context<rustc_thread_pool[507d1c80f68b01b9]::join::join::call<(), rustc_data_structures[6d8848fd01884538]::sync::parallel::par_slice::par_rec<&rustc_hir[47eeccf0a522356c]::hir::ItemId, rustc_data_structures[6d8848fd01884538]::sync::parallel::try_par_for_each_in<&[rustc_hir[47eeccf0a522356c]::hir::ItemId], rustc_span[a5d23146c59d8fe6]::ErrorGuaranteed, <rustc_middle[cb45d0df77280ce6]::hir::ModuleItems>::par_items<rustc_hir_analysis[6cd5ab551d9a9249]::check::wfcheck::check_type_wf::{closure#0}>::{closure#0}>::{closure#0}::{closure#0}>::{closure#1}>::{closure#0}, rustc_thread_pool[507d1c80f68b01b9]::join::join::call<(), rustc_data_structures[6d8848fd01884538]::sync::parallel::par_slice::par_rec<&rustc_hir[47eeccf0a522356c]::hir::ItemId, rustc_data_structures[6d8848fd01884538]::sync::parallel::try_par_for_each_in<&[rustc_hir[47eeccf0a522356c]::hir::ItemId], rustc_span[a5d23146c59d8fe6]::ErrorGuaranteed, <rustc_middle[cb45d0df77280ce6]::hir::ModuleItems>::par_items<rustc_hir_analysis[6cd5ab551d9a9249]::check::wfcheck::check_type_wf::{closure#0}>::{closure#0}>::{closure#0}::{closure#0}>::{closure#2}>::{closure#0}, (), ()>::{closure#0}::{closure#0}, ()> as rustc_thread_pool[507d1c80f68b01b9]::job::Job>::execute 34: 0x7826cae9ac1f - <rustc_thread_pool[507d1c80f68b01b9]::registry::WorkerThread>::wait_or_steal_until_cold 35: 0x7826cae98511 - <rustc_thread_pool[507d1c80f68b01b9]::registry::ThreadBuilder>::run 36: 0x7826ca24e9ed - std[ad4a270f57f76841]::sys::backtrace::__rust_begin_short_backtrace::<<rustc_thread_pool[507d1c80f68b01b9]::ThreadPoolBuilder>::build_scoped<rustc_interface[8232d73bd36e85ac]::util::run_in_thread_pool_with_globals<rustc_interface[8232d73bd36e85ac]::interface::run_compiler<(), rustc_driver_impl[55fe545c67ec0c63]::run_compiler::{closure#0}>::{closure#1}, ()>::{closure#5}::{closure#0}::{closure#0}, rustc_interface[8232d73bd36e85ac]::util::run_in_thread_pool_with_globals<rustc_interface[8232d73bd36e85ac]::interface::run_compiler<(), rustc_driver_impl[55fe545c67ec0c63]::run_compiler::{closure#0}>::{closure#1}, ()>::{closure#5}::{closure#0}::{closure#1}, ()>::{closure#0}::{closure#0}::{closure#0}, ()> 37: 0x7826ca25b6d2 - <<std[ad4a270f57f76841]::thread::Builder>::spawn_unchecked_<<rustc_thread_pool[507d1c80f68b01b9]::ThreadPoolBuilder>::build_scoped<rustc_interface[8232d73bd36e85ac]::util::run_in_thread_pool_with_globals<rustc_interface[8232d73bd36e85ac]::interface::run_compiler<(), rustc_driver_impl[55fe545c67ec0c63]::run_compiler::{closure#0}>::{closure#1}, ()>::{closure#5}::{closure#0}::{closure#0}, rustc_interface[8232d73bd36e85ac]::util::run_in_thread_pool_with_globals<rustc_interface[8232d73bd36e85ac]::interface::run_compiler<(), rustc_driver_impl[55fe545c67ec0c63]::run_compiler::{closure#0}>::{closure#1}, ()>::{closure#5}::{closure#0}::{closure#1}, ()>::{closure#0}::{closure#0}::{closure#0}, ()>::{closure#1} as core[a861b2038775984f]::ops::function::FnOnce<()>>::call_once::{shim:vtable#0} 38: 0x7826ccbd8ebd - std::sys::pal::unix::thread::Thread::new::thread_start::h17b2a9d1f5f7a32d 39: 0x7826c645a7eb - <unknown> 40: 0x7826c64de18c - <unknown> 41: 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.90.0-nightly (0fb279be1 2025-07-13) running on x86_64-unknown-linux-gnu note: compiler flags: -Z incremental-verify-ich=yes -C incremental=[REDACTED] -C debuginfo=2 -C link-dead-code=true -Z validate-mir -Z query-dep-graph -Z threads=4 query stack during panic: #0 [evaluate_obligation] evaluating trait selection obligation `<() as TraitA<'a>>::K == ValTree(Leaf(0x00): u8)` #1 [check_well_formed] checking that `<impl at /tmp/icemaker_global_tempdir.ttIYrYCPM7Xu/rustc_testrunner_tmpdir_reporting.btX7oW3u9Dsn/mvce.rs:9:1: 9:52>` is well-formed #2 [check_type_wf] checking that types are well-formed #3 [analysis] running analysis passes on this crate end of query stack error: aborting due to 6 previous errors Some errors have detailed explanations: E0106, E0107, E0601, E0658, E0726. For more information about an error, try `rustc --explain E0106`. 

Metadata

Metadata

Assignees

No one assigned

    Labels

    C-bugCategory: This is a bug.F-associated_const_equality`#![feature(associated_const_equality)]`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

    Status

    Can Do

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions