Skip to content

[ICE]: unexpected overflowed when processing region obligations #151461

@matthiaskrgr

Description

@matthiaskrgr

auto-reduced (treereduce-rust):

//@compile-flags: -Znext-solver=globally
trait X<'a> {
    type U: ?Sized;
}

impl X<'_> for u32
where
    for<'b> <Self as X<'b>>::U: 'a,
{
    type U = str;
}

original:

trait X<'a>
where
    for<'b> <Self as X<'b>>::U: Clone,
{
    type U: ?Sized;
    fn f(&self, x: &Self::U) {
        <Self::U>::clone(x);
    }
}

impl X<'_> for u32 //~ ERROR overflow evaluating the requirement `for<'b> u32: X<'b>`
where
    for<'b> <Self as X<'b>>::U: 'a,
{
    type U = str;
}

fn main() {
    1u32.f("abc");
}

Version information

rustc 1.95.0-nightly (625b63f9e 2026-01-21)
binary: rustc
commit-hash: 625b63f9e148d511e187c71e5f70643ee62c77fb
commit-date: 2026-01-21
host: x86_64-unknown-linux-gnu
release: 1.95.0-nightly
LLVM version: 21.1.8

Possibly related line of code:

}
if !self.tcx.recursion_limit().value_within_limit(iteration) {
// This may actually be reachable. If so, we should convert
// this to a proper error/consider whether we should detect
// this somewhere else.
bug!(
"unexpected overflowed when processing region obligations: {my_region_obligations:#?}"
);
}
for TypeOutlivesConstraint { sup_type, sub_region, origin } in my_region_obligations {
let outlives = ty::Binder::dummy(ty::OutlivesPredicate(sup_type, sub_region));

Command:
/home/matthias/.rustup/toolchains/master/bin/rustc -Znext-solver=globally

Program output

error[E0261]: use of undeclared lifetime name `'a`
 --> /tmp/icemaker_global_tempdir.vp6JkNZDbYoq/rustc_testrunner_tmpdir_reporting.GNAg2JUaYoJH/mvce.rs:7:33
  |
7 |     for<'b> <Self as X<'b>>::U: 'a,
  |                                 ^^ undeclared lifetime
  |
  = 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
  |
7 |     for<'a, 'b> <Self as X<'b>>::U: 'a,
  |         +++
help: consider introducing lifetime `'a` here
  |
5 | impl<'a> X<'_> for u32
  |     ++++

error[E0601]: `main` function not found in crate `mvce`
  --> /tmp/icemaker_global_tempdir.vp6JkNZDbYoq/rustc_testrunner_tmpdir_reporting.GNAg2JUaYoJH/mvce.rs:10:2
   |
10 | }
   |  ^ consider adding a `main` function to `/tmp/icemaker_global_tempdir.vp6JkNZDbYoq/rustc_testrunner_tmpdir_reporting.GNAg2JUaYoJH/mvce.rs`

error: internal compiler error: /rustc-dev/625b63f9e148d511e187c71e5f70643ee62c77fb/compiler/rustc_infer/src/infer/outlives/obligations.rs:220:17: unexpected overflowed when processing region obligations: [
                                    TypeOutlivesConstraint {
                                        sub_region: '{region error},
                                        sup_type: Alias(
                                            Projection,
                                            AliasTy {
                                                args: [
                                                    u32,
                                                    '!131_0.Named(DefId(0:7 ~ mvce[3e22]::{impl#0}::'b)),
                                                ],
                                                def_id: DefId(0:5 ~ mvce[3e22]::X::U),
                                                ..
                                            },
                                        ),
                                        origin: RelateParamBound(
                                            no-location (#0),
                                            Alias(
                                                Projection,
                                                AliasTy {
                                                    args: [
                                                        u32,
                                                        '!131_0.Named(DefId(0:7 ~ mvce[3e22]::{impl#0}::'b)),
                                                    ],
                                                    def_id: DefId(0:5 ~ mvce[3e22]::X::U),
                                                    ..
                                                },
                                            ),
                                            None,
                                        ),
                                    },
                                ]


thread 'rustc' (186588) panicked at /rustc-dev/625b63f9e148d511e187c71e5f70643ee62c77fb/compiler/rustc_infer/src/infer/outlives/obligations.rs:220:17:
Box<dyn Any>
stack backtrace:
   0:     0x7f4691210cf3 - <<std[fb3d5c90ac5b7f63]::sys::backtrace::BacktraceLock>::print::DisplayBacktrace as core[f6b43ac8430f38c9]::fmt::Display>::fmt
   1:     0x7f4691809756 - core[f6b43ac8430f38c9]::fmt::write
   2:     0x7f46912276e6 - <std[fb3d5c90ac5b7f63]::sys::stdio::unix::Stderr as std[fb3d5c90ac5b7f63]::io::Write>::write_fmt
   3:     0x7f46911e6d28 - std[fb3d5c90ac5b7f63]::panicking::default_hook::{closure#0}
   4:     0x7f4691204423 - std[fb3d5c90ac5b7f63]::panicking::default_hook
   5:     0x7f46901e607a - std[fb3d5c90ac5b7f63]::panicking::update_hook::<alloc[f2f1d3597b721dce]::boxed::Box<rustc_driver_impl[e2906432e8e0cdf6]::install_ice_hook::{closure#1}>>::{closure#0}
   6:     0x7f4691204702 - std[fb3d5c90ac5b7f63]::panicking::panic_with_hook
   7:     0x7f4690224371 - std[fb3d5c90ac5b7f63]::panicking::begin_panic::<rustc_errors[a7fc3a61ce6b7a9f]::ExplicitBug>::{closure#0}
   8:     0x7f4690214a26 - std[fb3d5c90ac5b7f63]::sys::backtrace::__rust_end_short_backtrace::<std[fb3d5c90ac5b7f63]::panicking::begin_panic<rustc_errors[a7fc3a61ce6b7a9f]::ExplicitBug>::{closure#0}, !>
   9:     0x7f469021478f - std[fb3d5c90ac5b7f63]::panicking::begin_panic::<rustc_errors[a7fc3a61ce6b7a9f]::ExplicitBug>
  10:     0x7f4690242171 - <rustc_errors[a7fc3a61ce6b7a9f]::diagnostic::BugAbort as rustc_errors[a7fc3a61ce6b7a9f]::diagnostic::EmissionGuarantee>::emit_producing_guarantee
  11:     0x7f46907e67a9 - rustc_middle[7c1e44e38e5ae512]::util::bug::opt_span_bug_fmt::<rustc_span[c096204aa74ff282]::span_encoding::Span>::{closure#0}
  12:     0x7f46907e6932 - rustc_middle[7c1e44e38e5ae512]::ty::context::tls::with_opt::<rustc_middle[7c1e44e38e5ae512]::util::bug::opt_span_bug_fmt<rustc_span[c096204aa74ff282]::span_encoding::Span>::{closure#0}, !>::{closure#0}
  13:     0x7f46907d7b7b - rustc_middle[7c1e44e38e5ae512]::ty::context::tls::with_context_opt::<rustc_middle[7c1e44e38e5ae512]::ty::context::tls::with_opt<rustc_middle[7c1e44e38e5ae512]::util::bug::opt_span_bug_fmt<rustc_span[c096204aa74ff282]::span_encoding::Span>::{closure#0}, !>::{closure#0}, !>
  14:     0x7f468e49cb94 - rustc_middle[7c1e44e38e5ae512]::util::bug::bug_fmt
  15:     0x7f46922a4a29 - <rustc_infer[951fea966d908995]::infer::InferCtxt as rustc_trait_selection[b2a773cbaa62fcc]::regions::InferCtxtRegionExt>::resolve_regions_with_outlives_env
  16:     0x7f46922915dc - <rustc_infer[951fea966d908995]::infer::InferCtxt as rustc_trait_selection[b2a773cbaa62fcc]::regions::InferCtxtRegionExt>::resolve_regions::<[rustc_middle[7c1e44e38e5ae512]::ty::Ty; 0usize]>
  17:     0x7f469229c524 - rustc_trait_selection[b2a773cbaa62fcc]::traits::do_normalize_predicates
  18:     0x7f46920648ff - rustc_trait_selection[b2a773cbaa62fcc]::traits::normalize_param_env_or_error
  19:     0x7f4692069dee - rustc_ty_utils[ebab42b0a530f21e]::ty::param_env
  20:     0x7f469206986b - rustc_query_impl[b1dbb5ee6e859e63]::plumbing::__rust_begin_short_backtrace::<rustc_query_impl[b1dbb5ee6e859e63]::query_impl::param_env::dynamic_query::{closure#2}::{closure#0}, rustc_middle[7c1e44e38e5ae512]::query::erase::Erased<[u8; 8usize]>>
  21:     0x7f46918111c5 - rustc_query_system[662316397b943afb]::query::plumbing::try_execute_query::<rustc_query_impl[b1dbb5ee6e859e63]::DynamicConfig<rustc_query_system[662316397b943afb]::query::caches::DefIdCache<rustc_middle[7c1e44e38e5ae512]::query::erase::Erased<[u8; 8usize]>>, false, false, false>, rustc_query_impl[b1dbb5ee6e859e63]::plumbing::QueryCtxt, false>
  22:     0x7f4691810cb1 - rustc_query_impl[b1dbb5ee6e859e63]::query_impl::param_env::get_query_non_incr::__rust_end_short_backtrace
  23:     0x7f46922ad1bd - rustc_ty_utils[ebab42b0a530f21e]::ty::impl_self_is_guaranteed_unsized
  24:     0x7f46922acd3b - rustc_query_impl[b1dbb5ee6e859e63]::plumbing::__rust_begin_short_backtrace::<rustc_query_impl[b1dbb5ee6e859e63]::query_impl::impl_self_is_guaranteed_unsized::dynamic_query::{closure#2}::{closure#0}, rustc_middle[7c1e44e38e5ae512]::query::erase::Erased<[u8; 1usize]>>
  25:     0x7f4691bd3620 - rustc_query_system[662316397b943afb]::query::plumbing::try_execute_query::<rustc_query_impl[b1dbb5ee6e859e63]::DynamicConfig<rustc_query_system[662316397b943afb]::query::caches::DefIdCache<rustc_middle[7c1e44e38e5ae512]::query::erase::Erased<[u8; 1usize]>>, false, false, false>, rustc_query_impl[b1dbb5ee6e859e63]::plumbing::QueryCtxt, false>
  26:     0x7f4691bd2ed0 - rustc_query_impl[b1dbb5ee6e859e63]::query_impl::impl_self_is_guaranteed_unsized::get_query_non_incr::__rust_end_short_backtrace
  27:     0x7f4691fb76c8 - rustc_hir_analysis[bccf3aa92971e1a2]::check::check::check_item_type
  28:     0x7f4691fb41e6 - rustc_hir_analysis[bccf3aa92971e1a2]::check::wfcheck::check_well_formed
  29:     0x7f4691fb41c7 - rustc_query_impl[b1dbb5ee6e859e63]::plumbing::__rust_begin_short_backtrace::<rustc_query_impl[b1dbb5ee6e859e63]::query_impl::check_well_formed::dynamic_query::{closure#2}::{closure#0}, rustc_middle[7c1e44e38e5ae512]::query::erase::Erased<[u8; 1usize]>>
  30:     0x7f4691fb3c3d - rustc_query_system[662316397b943afb]::query::plumbing::try_execute_query::<rustc_query_impl[b1dbb5ee6e859e63]::DynamicConfig<rustc_data_structures[147b1c54dfb69980]::vec_cache::VecCache<rustc_span[c096204aa74ff282]::def_id::LocalDefId, rustc_middle[7c1e44e38e5ae512]::query::erase::Erased<[u8; 1usize]>, rustc_query_system[662316397b943afb]::dep_graph::graph::DepNodeIndex>, false, false, false>, rustc_query_impl[b1dbb5ee6e859e63]::plumbing::QueryCtxt, false>
  31:     0x7f4691fb3742 - rustc_query_impl[b1dbb5ee6e859e63]::query_impl::check_well_formed::get_query_non_incr::__rust_end_short_backtrace
  32:     0x7f4691fb0e76 - rustc_hir_analysis[bccf3aa92971e1a2]::check::wfcheck::check_type_wf
  33:     0x7f4691fb0d79 - rustc_query_impl[b1dbb5ee6e859e63]::plumbing::__rust_begin_short_backtrace::<rustc_query_impl[b1dbb5ee6e859e63]::query_impl::check_type_wf::dynamic_query::{closure#2}::{closure#0}, rustc_middle[7c1e44e38e5ae512]::query::erase::Erased<[u8; 1usize]>>
  34:     0x7f4692a40b91 - rustc_query_system[662316397b943afb]::query::plumbing::try_execute_query::<rustc_query_impl[b1dbb5ee6e859e63]::DynamicConfig<rustc_query_system[662316397b943afb]::query::caches::SingleCache<rustc_middle[7c1e44e38e5ae512]::query::erase::Erased<[u8; 1usize]>>, false, false, false>, rustc_query_impl[b1dbb5ee6e859e63]::plumbing::QueryCtxt, false>
  35:     0x7f4692a40842 - rustc_query_impl[b1dbb5ee6e859e63]::query_impl::check_type_wf::get_query_non_incr::__rust_end_short_backtrace
  36:     0x7f46924a6896 - rustc_hir_analysis[bccf3aa92971e1a2]::check_crate
  37:     0x7f46919df95b - rustc_interface[c96bb79ace64ec0a]::passes::analysis
  38:     0x7f46919df5a7 - rustc_query_impl[b1dbb5ee6e859e63]::plumbing::__rust_begin_short_backtrace::<rustc_query_impl[b1dbb5ee6e859e63]::query_impl::analysis::dynamic_query::{closure#2}::{closure#0}, rustc_middle[7c1e44e38e5ae512]::query::erase::Erased<[u8; 0usize]>>
  39:     0x7f4692a418e3 - rustc_query_system[662316397b943afb]::query::plumbing::try_execute_query::<rustc_query_impl[b1dbb5ee6e859e63]::DynamicConfig<rustc_query_system[662316397b943afb]::query::caches::SingleCache<rustc_middle[7c1e44e38e5ae512]::query::erase::Erased<[u8; 0usize]>>, false, false, false>, rustc_query_impl[b1dbb5ee6e859e63]::plumbing::QueryCtxt, false>
  40:     0x7f4692a416ce - rustc_query_impl[b1dbb5ee6e859e63]::query_impl::analysis::get_query_non_incr::__rust_end_short_backtrace
  41:     0x7f4692b6d8d1 - <rustc_interface[c96bb79ace64ec0a]::passes::create_and_enter_global_ctxt<core[f6b43ac8430f38c9]::option::Option<rustc_interface[c96bb79ace64ec0a]::queries::Linker>, rustc_driver_impl[e2906432e8e0cdf6]::run_compiler::{closure#0}::{closure#2}>::{closure#2} as core[f6b43ac8430f38c9]::ops::function::FnOnce<(&rustc_session[ded86e37f409d2a]::session::Session, rustc_middle[7c1e44e38e5ae512]::ty::context::CurrentGcx, alloc[f2f1d3597b721dce]::sync::Arc<rustc_data_structures[147b1c54dfb69980]::jobserver::Proxy>, &std[fb3d5c90ac5b7f63]::sync::once_lock::OnceLock<rustc_middle[7c1e44e38e5ae512]::ty::context::GlobalCtxt>, &rustc_data_structures[147b1c54dfb69980]::sync::worker_local::WorkerLocal<rustc_middle[7c1e44e38e5ae512]::arena::Arena>, &rustc_data_structures[147b1c54dfb69980]::sync::worker_local::WorkerLocal<rustc_hir[586ee495a70320e8]::Arena>, rustc_driver_impl[e2906432e8e0cdf6]::run_compiler::{closure#0}::{closure#2})>>::call_once::{shim:vtable#0}
  42:     0x7f46929af82a - rustc_interface[c96bb79ace64ec0a]::interface::run_compiler::<(), rustc_driver_impl[e2906432e8e0cdf6]::run_compiler::{closure#0}>::{closure#1}
  43:     0x7f46929dfb7e - std[fb3d5c90ac5b7f63]::sys::backtrace::__rust_begin_short_backtrace::<rustc_interface[c96bb79ace64ec0a]::util::run_in_thread_with_globals<rustc_interface[c96bb79ace64ec0a]::util::run_in_thread_pool_with_globals<rustc_interface[c96bb79ace64ec0a]::interface::run_compiler<(), rustc_driver_impl[e2906432e8e0cdf6]::run_compiler::{closure#0}>::{closure#1}, ()>::{closure#0}, ()>::{closure#0}::{closure#0}, ()>
  44:     0x7f46929e00a0 - <std[fb3d5c90ac5b7f63]::thread::lifecycle::spawn_unchecked<rustc_interface[c96bb79ace64ec0a]::util::run_in_thread_with_globals<rustc_interface[c96bb79ace64ec0a]::util::run_in_thread_pool_with_globals<rustc_interface[c96bb79ace64ec0a]::interface::run_compiler<(), rustc_driver_impl[e2906432e8e0cdf6]::run_compiler::{closure#0}>::{closure#1}, ()>::{closure#0}, ()>::{closure#0}::{closure#0}, ()>::{closure#1} as core[f6b43ac8430f38c9]::ops::function::FnOnce<()>>::call_once::{shim:vtable#0}
  45:     0x7f46929e0f68 - <std[fb3d5c90ac5b7f63]::sys::thread::unix::Thread>::new::thread_start
  46:     0x7f468c29698b - <unknown>
  47:     0x7f468c31a9cc - <unknown>
  48:                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.95.0-nightly (625b63f9e 2026-01-21) running on x86_64-unknown-linux-gnu

note: compiler flags: -Z next-solver=globally -Z dump-mir-dir=dir

query stack during panic:
#0 [param_env] computing normalized predicates of `<impl at /tmp/icemaker_global_tempdir.vp6JkNZDbYoq/rustc_testrunner_tmpdir_reporting.GNAg2JUaYoJH/mvce.rs:5:1: 7:36>`
#1 [impl_self_is_guaranteed_unsized] computing whether `<impl at /tmp/icemaker_global_tempdir.vp6JkNZDbYoq/rustc_testrunner_tmpdir_reporting.GNAg2JUaYoJH/mvce.rs:5:1: 7:36>` has a guaranteed unsized self type
#2 [check_well_formed] checking that `<impl at /tmp/icemaker_global_tempdir.vp6JkNZDbYoq/rustc_testrunner_tmpdir_reporting.GNAg2JUaYoJH/mvce.rs:5:1: 7:36>` is well-formed
#3 [check_type_wf] checking that types are well-formed
#4 [analysis] running analysis passes on crate `mvce`
end of query stack
error: aborting due to 3 previous errors

Some errors have detailed explanations: E0261, E0601.
For more information about an error, try `rustc --explain E0261`.

@rustbot label +WG-trait-system-refactor

Metadata

Metadata

Assignees

No one assigned

    Labels

    C-bugCategory: This is a bug.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.WG-trait-system-refactorThe Rustc Trait System Refactor Initiative (-Znext-solver)needs-triageThis issue may need triage. Remove it if it has been sufficiently triaged.

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions