Skip to content

[ICE]: could not normalize for<'a> <i32 as FnOnce<(&'a mut i32,)>>::Output: 'a #151316

Description

@matthiaskrgr

auto-reduced (treereduce-rust):

//@compile-flags: --edition=2024 -Znext-solver=globally
#![feature(unboxed_closures)]
#![feature(non_lifetime_binders)]
struct S<T>(T)
where
    for<F> F:,
    for<'a> <i32 as FnOnce<(&'a mut i32,)>>::Output: Future + 'a;
fn main() {}

original:

struct S<T>(T) where
    for<F> F:,
    for<'a> <i32 as FnOnce<(&'a mut i32,)>>::Output: Future<Output = ()> + 'a,;                                    
fn main() {}

Version information

rustc 1.95.0-nightly (621d76794 2026-01-18)
binary: rustc
commit-hash: 621d76794c76fc21c0a6151fbc090120e0230a91
commit-date: 2026-01-18
host: x86_64-unknown-linux-gnu
release: 1.95.0-nightly
LLVM version: 21.1.8

Command:
/home/matthias/.rustup/toolchains/master/bin/rustc --edition=2024 -Znext-solver=globally -Zcrate-attr=feature(unboxed_closures) -Zcrate-attr=feature(non_lifetime_binders)

Program output

warning: the feature `non_lifetime_binders` is incomplete and may not be safe to use and/or cause compiler crashes
 --> <crate attribute>:1:12
  |
1 | #![feature(non_lifetime_binders)]
  |            ^^^^^^^^^^^^^^^^^^^^
  |
  = note: see issue #108185 <https://github.com/rust-lang/rust/issues/108185> for more information
  = note: `#[warn(incomplete_features)]` on by default

warning: struct `S` is never constructed
 --> /tmp/icemaker_global_tempdir.wwNJpebPj8wh/rustc_testrunner_tmpdir_reporting.FwA7HEom69gA/mvce.rs:1:8
  |
1 | struct S<T>(T)
  |        ^
  |
  = note: `#[warn(dead_code)]` (part of `#[warn(unused)]`) on by default

warning: 2 warnings emitted

note: no errors encountered even though delayed bugs were created

note: those delayed bugs will now be shown as internal compiler errors

error: internal compiler error: could not normalize `for<'a> <i32 as FnOnce<(&'a mut i32,)>>::Output: 'a`
  |
  = note: delayed at /rustc-dev/621d76794c76fc21c0a6151fbc090120e0230a91/compiler/rustc_trait_selection/src/regions.rs:41:41
             0: <rustc_errors::DiagCtxtInner>::emit_diagnostic
             1: <rustc_errors::DiagCtxtHandle>::emit_diagnostic
             2: <rustc_span::ErrorGuaranteed as rustc_errors::diagnostic::EmissionGuarantee>::emit_producing_guarantee
             3: <rustc_errors::DiagCtxtHandle>::delayed_bug::<alloc::string::String>
             4: <rustc_infer::infer::InferCtxt as rustc_trait_selection::regions::InferCtxtRegionExt>::resolve_regions::<[rustc_middle::ty::Ty; 0]>
             5: rustc_trait_selection::traits::do_normalize_predicates
             6: rustc_trait_selection::traits::normalize_param_env_or_error
             7: rustc_ty_utils::ty::param_env
             8: rustc_query_impl::plumbing::__rust_begin_short_backtrace::<rustc_query_impl::query_impl::param_env::dynamic_query::{closure#2}::{closure#0}, rustc_middle::query::erase::Erased<[u8; 8]>>
             9: rustc_query_system::query::plumbing::try_execute_query::<rustc_query_impl::DynamicConfig<rustc_query_system::query::caches::DefIdCache<rustc_middle::query::erase::Erased<[u8; 8]>>, false, false, false>, rustc_query_impl::plumbing::QueryCtxt, false>
            10: rustc_query_impl::query_impl::param_env::get_query_non_incr::__rust_end_short_backtrace
            11: rustc_hir_analysis::check::wfcheck::check_type_defn
            12: rustc_hir_analysis::check::check::check_item_type
            13: rustc_hir_analysis::check::wfcheck::check_well_formed
            14: rustc_query_impl::plumbing::__rust_begin_short_backtrace::<rustc_query_impl::query_impl::check_well_formed::dynamic_query::{closure#2}::{closure#0}, rustc_middle::query::erase::Erased<[u8; 1]>>
            15: rustc_query_system::query::plumbing::try_execute_query::<rustc_query_impl::DynamicConfig<rustc_data_structures::vec_cache::VecCache<rustc_span::def_id::LocalDefId, rustc_middle::query::erase::Erased<[u8; 1]>, rustc_query_system::dep_graph::graph::DepNodeIndex>, false, false, false>, rustc_query_impl::plumbing::QueryCtxt, false>
            16: rustc_query_impl::query_impl::check_well_formed::get_query_non_incr::__rust_end_short_backtrace
            17: rustc_hir_analysis::check::wfcheck::check_type_wf
            18: rustc_query_impl::plumbing::__rust_begin_short_backtrace::<rustc_query_impl::query_impl::check_type_wf::dynamic_query::{closure#2}::{closure#0}, rustc_middle::query::erase::Erased<[u8; 1]>>
            19: rustc_query_system::query::plumbing::try_execute_query::<rustc_query_impl::DynamicConfig<rustc_query_system::query::caches::SingleCache<rustc_middle::query::erase::Erased<[u8; 1]>>, false, false, false>, rustc_query_impl::plumbing::QueryCtxt, false>
            20: rustc_query_impl::query_impl::check_type_wf::get_query_non_incr::__rust_end_short_backtrace
            21: rustc_hir_analysis::check_crate
            22: rustc_interface::passes::analysis
            23: rustc_query_impl::plumbing::__rust_begin_short_backtrace::<rustc_query_impl::query_impl::analysis::dynamic_query::{closure#2}::{closure#0}, rustc_middle::query::erase::Erased<[u8; 0]>>
            24: rustc_query_system::query::plumbing::try_execute_query::<rustc_query_impl::DynamicConfig<rustc_query_system::query::caches::SingleCache<rustc_middle::query::erase::Erased<[u8; 0]>>, false, false, false>, rustc_query_impl::plumbing::QueryCtxt, false>
            25: rustc_query_impl::query_impl::analysis::get_query_non_incr::__rust_end_short_backtrace
            26: <rustc_interface::passes::create_and_enter_global_ctxt<core::option::Option<rustc_interface::queries::Linker>, rustc_driver_impl::run_compiler::{closure#0}::{closure#2}>::{closure#2} as core::ops::function::FnOnce<(&rustc_session::session::Session, rustc_middle::ty::context::CurrentGcx, alloc::sync::Arc<rustc_data_structures::jobserver::Proxy>, &std::sync::once_lock::OnceLock<rustc_middle::ty::context::GlobalCtxt>, &rustc_data_structures::sync::worker_local::WorkerLocal<rustc_middle::arena::Arena>, &rustc_data_structures::sync::worker_local::WorkerLocal<rustc_hir::Arena>, rustc_driver_impl::run_compiler::{closure#0}::{closure#2})>>::call_once::{shim:vtable#0}
            27: rustc_interface::interface::run_compiler::<(), rustc_driver_impl::run_compiler::{closure#0}>::{closure#1}
            28: std::sys::backtrace::__rust_begin_short_backtrace::<rustc_interface::util::run_in_thread_with_globals<rustc_interface::util::run_in_thread_pool_with_globals<rustc_interface::interface::run_compiler<(), rustc_driver_impl::run_compiler::{closure#0}>::{closure#1}, ()>::{closure#0}, ()>::{closure#0}::{closure#0}, ()>
            29: <std::thread::lifecycle::spawn_unchecked<rustc_interface::util::run_in_thread_with_globals<rustc_interface::util::run_in_thread_pool_with_globals<rustc_interface::interface::run_compiler<(), rustc_driver_impl::run_compiler::{closure#0}>::{closure#1}, ()>::{closure#0}, ()>::{closure#0}::{closure#0}, ()>::{closure#1} as core::ops::function::FnOnce<()>>::call_once::{shim:vtable#0}
            30: <std::sys::thread::unix::Thread>::new::thread_start
            31: <unknown>
            32: <unknown>
          

error: internal compiler error: could not normalize `for<'a> <i32 as FnOnce<(&'a mut i32,)>>::Output: 'a`
  |
  = note: delayed at /rustc-dev/621d76794c76fc21c0a6151fbc090120e0230a91/compiler/rustc_trait_selection/src/regions.rs:41:41
             0: <rustc_errors::DiagCtxtInner>::emit_diagnostic
             1: <rustc_errors::DiagCtxtHandle>::emit_diagnostic
             2: <rustc_span::ErrorGuaranteed as rustc_errors::diagnostic::EmissionGuarantee>::emit_producing_guarantee
             3: <rustc_errors::DiagCtxtHandle>::delayed_bug::<alloc::string::String>
             4: <rustc_infer::infer::outlives::env::OutlivesEnvironment as rustc_trait_selection::regions::OutlivesEnvironmentBuildExt>::new_with_implied_bounds_compat::<core::iter::adapters::copied::Copied<indexmap::set::iter::Iter<rustc_middle::ty::Ty>>>
             5: rustc_hir_analysis::check::wfcheck::check_type_defn
             6: rustc_hir_analysis::check::check::check_item_type
             7: rustc_hir_analysis::check::wfcheck::check_well_formed
             8: rustc_query_impl::plumbing::__rust_begin_short_backtrace::<rustc_query_impl::query_impl::check_well_formed::dynamic_query::{closure#2}::{closure#0}, rustc_middle::query::erase::Erased<[u8; 1]>>
             9: rustc_query_system::query::plumbing::try_execute_query::<rustc_query_impl::DynamicConfig<rustc_data_structures::vec_cache::VecCache<rustc_span::def_id::LocalDefId, rustc_middle::query::erase::Erased<[u8; 1]>, rustc_query_system::dep_graph::graph::DepNodeIndex>, false, false, false>, rustc_query_impl::plumbing::QueryCtxt, false>
            10: rustc_query_impl::query_impl::check_well_formed::get_query_non_incr::__rust_end_short_backtrace
            11: rustc_hir_analysis::check::wfcheck::check_type_wf
            12: rustc_query_impl::plumbing::__rust_begin_short_backtrace::<rustc_query_impl::query_impl::check_type_wf::dynamic_query::{closure#2}::{closure#0}, rustc_middle::query::erase::Erased<[u8; 1]>>
            13: rustc_query_system::query::plumbing::try_execute_query::<rustc_query_impl::DynamicConfig<rustc_query_system::query::caches::SingleCache<rustc_middle::query::erase::Erased<[u8; 1]>>, false, false, false>, rustc_query_impl::plumbing::QueryCtxt, false>
            14: rustc_query_impl::query_impl::check_type_wf::get_query_non_incr::__rust_end_short_backtrace
            15: rustc_hir_analysis::check_crate
            16: rustc_interface::passes::analysis
            17: rustc_query_impl::plumbing::__rust_begin_short_backtrace::<rustc_query_impl::query_impl::analysis::dynamic_query::{closure#2}::{closure#0}, rustc_middle::query::erase::Erased<[u8; 0]>>
            18: rustc_query_system::query::plumbing::try_execute_query::<rustc_query_impl::DynamicConfig<rustc_query_system::query::caches::SingleCache<rustc_middle::query::erase::Erased<[u8; 0]>>, false, false, false>, rustc_query_impl::plumbing::QueryCtxt, false>
            19: rustc_query_impl::query_impl::analysis::get_query_non_incr::__rust_end_short_backtrace
            20: <rustc_interface::passes::create_and_enter_global_ctxt<core::option::Option<rustc_interface::queries::Linker>, rustc_driver_impl::run_compiler::{closure#0}::{closure#2}>::{closure#2} as core::ops::function::FnOnce<(&rustc_session::session::Session, rustc_middle::ty::context::CurrentGcx, alloc::sync::Arc<rustc_data_structures::jobserver::Proxy>, &std::sync::once_lock::OnceLock<rustc_middle::ty::context::GlobalCtxt>, &rustc_data_structures::sync::worker_local::WorkerLocal<rustc_middle::arena::Arena>, &rustc_data_structures::sync::worker_local::WorkerLocal<rustc_hir::Arena>, rustc_driver_impl::run_compiler::{closure#0}::{closure#2})>>::call_once::{shim:vtable#0}
            21: rustc_interface::interface::run_compiler::<(), rustc_driver_impl::run_compiler::{closure#0}>::{closure#1}
            22: std::sys::backtrace::__rust_begin_short_backtrace::<rustc_interface::util::run_in_thread_with_globals<rustc_interface::util::run_in_thread_pool_with_globals<rustc_interface::interface::run_compiler<(), rustc_driver_impl::run_compiler::{closure#0}>::{closure#1}, ()>::{closure#0}, ()>::{closure#0}::{closure#0}, ()>
            23: <std::thread::lifecycle::spawn_unchecked<rustc_interface::util::run_in_thread_with_globals<rustc_interface::util::run_in_thread_pool_with_globals<rustc_interface::interface::run_compiler<(), rustc_driver_impl::run_compiler::{closure#0}>::{closure#1}, ()>::{closure#0}, ()>::{closure#0}::{closure#0}, ()>::{closure#1} as core::ops::function::FnOnce<()>>::call_once::{shim:vtable#0}
            24: <std::sys::thread::unix::Thread>::new::thread_start
            25: <unknown>
            26: <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 (621d76794 2026-01-18) running on x86_64-unknown-linux-gnu

note: compiler flags: -Z next-solver=globally -Z crate-attr=feature(unboxed_closures) -Z crate-attr=feature(non_lifetime_binders) -Z dump-mir-dir=dir

query stack during panic:
end of query stack

@rustbot label +F-unboxed_closures +F-non_lifetime_binders +WG-trait-system-refactor

Activity

  1. added
    I-ICE
    T-compiler
    C-bug
    on Jan 18, 2026
  2. added
    needs-triage
    F-non_lifetime_binders
    F-unboxed_closures
    WG-trait-system-refactor
    on Jan 18, 2026
  3. removed
    F-non_lifetime_binders
    on Jan 18, 2026
  4. matthiaskrgr commented on Jan 18, 2026

    @matthiaskrgr
    MemberAuthor
    #![feature(unboxed_closures)]
    use std::future::Future;
    fn wrapper<F>()
    where
        F:,
        for<'a> <i32 as FnOnce<&'a mut i32>>::Output: Future + 'a,
    {
    }
    fn main() {}

    previously:

    error[E0277]: expected a `FnOnce<&'a mut i32>` closure, found `i32`
     --> code.rs:3:1
      |
    3 | / fn wrapper<F>()
    4 | | where
    5 | |     F:,
    6 | |     for<'a> <i32 as FnOnce<&'a mut i32>>::Output: Future + 'a,
      | |______________________________________________________________^ expected an `FnOnce<&'a mut i32>` closure, found `i32`
      |
      = help: the trait `for<'a> FnOnce<&'a mut i32>` is not implemented for `i32`
    
    error: aborting due to 1 previous error
    
    For more information about this error, try `rustc --explain E0277`.
    
  5. matthiaskrgr commented on Jan 18, 2026

    @matthiaskrgr
    MemberAuthor

    Regression in nightly-2025-01-31

      commit[0] 2025-01-29: Auto merge of #134248 - oli-obk:patkind-path-removal, r=BoxyUwU
      commit[1] 2025-01-29: Auto merge of #135818 - jieyouxu:migrate-translation, r=compiler-errors
      commit[2] 2025-01-30: Auto merge of #136035 - SpecificProtagonist:miri-zeroed-alloc, r=oli-obk
      commit[3] 2025-01-30: Auto merge of #136272 - Zalathar:rollup-6s577l5, r=Zalathar
      commit[4] 2025-01-30: Auto merge of #136038 - compiler-errors:outlives, r=lcnr
      commit[5] 2025-01-30: Auto merge of #134824 - niklasf:int_from_ascii, r=ibraheemdev
      commit[6] 2025-01-30: Auto merge of #136292 - matthiaskrgr:rollup-fw1tlca, r=matthiaskrgr
      commit[7] 2025-01-30: Auto merge of #135030 - Flakebi:require-cpu, r=workingjubilee
    
  6. removed
    needs-triage
    on Jan 21, 2026
  7. matthiaskrgr commented on Jul 5, 2026

    @matthiaskrgr
    MemberAuthor
    trait Trait<'a, 'b> {
        type Assoc;
    }
    struct ImpliedBound<'a, 'c, T>(T, &'a (), &'c ())
    where
        for<'b> <T as Trait<'a, 'b>>::Assoc: 'c;
    fn main() {}
    warning: trait `Trait` is never used
     --> /tmp/crash.rs:1:7
      |
    1 | trait Trait<'a, 'b> {
      |       ^^^^^
      |
      = note: `#[warn(dead_code)]` (part of `#[warn(unused)]`) on by default
    
    warning: struct `ImpliedBound` is never constructed
     --> /tmp/crash.rs:4:8
      |
    4 | struct ImpliedBound<'a, 'c, T>(T, &'a (), &'c ())
      |        ^^^^^^^^^^^^
    
    warning: 2 warnings emitted
    
    note: no errors encountered even though delayed bugs were created
    
    note: those delayed bugs will now be shown as internal compiler errors
    
    error: internal compiler error: could not normalize `for<'b> <T as Trait<'a, 'b>>::Assoc: 'c`
      |
      = note: delayed at /rustc-dev/c397dae808f70caebab1fc4e11b3edf7e59f58c7/compiler/rustc_trait_selection/src/regions.rs:42:41 - disabled backtrace
    
    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-05T07_22_14-2094442.txt` to your bug report
    
    note: rustc 1.98.0-nightly (c397dae80 2026-07-02) running on x86_64-unknown-linux-gnu
    
    note: compiler flags: -Z validate-mir -Z next-solver=globally
    
    query stack during panic:
    end of query stack
    
  8. removed
    F-unboxed_closures
    on Jul 5, 2026
  9. lcnr commented on Oct 8, 2026

    @lcnr
    Contributor

    this has been fixed, should figure out the relevant PR which did so and then add tests

  10. added
    E-needs-test
    E-needs-bisection
    on Oct 14, 2026
  11. added 2 commits that reference this issue on Nov 24, 2026
  12. added a commit that references this issue on Nov 24, 2026
  13. added a commit that references this issue on Nov 24, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    C-bugE-needs-bisectionE-needs-testI-ICET-compilerWG-trait-system-refactor

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions