Skip to content

ICE: cannot convert '{erased} to a region vid #146985

Open

Description

@matthiaskrgr

auto-reduced (treereduce-rust):

//@compile-flags: --edition=2024 
fn invalid_future() -> impl Future {
    create_complex_future()
}

fn create_complex_future() -> impl Future<Output = impl ReturnsSend> {
    async { &|| async { invalid_future().await } }
}

fn coerce_impl_trait() -> impl Future<Output = impl Send> {
    create_complex_future()
}

trait ReturnsSend {}

impl<F, R> ReturnsSend for F
where
    F: Fn() -> R,
    R: Send,
{
}

fn main() {}

original:

//@ edition: 2021

use std::future::Future;

fn invalid_future() -> impl Future {
    create_complex_future()
}
//~^ ERROR `()` is not a future

fn create_complex_future() -> impl Future<Output = impl ReturnsSend> {
    async { &|| async { invalid_future().await } }
}

fn coerce_impl_trait() -> impl Future<Output = impl Send> {
    create_complex_future()
}

trait ReturnsSend {}

impl<F, R> ReturnsSend for F
where
    F: Fn() -> R,
    R: Send,
{
}

fn main() {}

Version information

rustc 1.92.0-nightly (e9385f9ee 2025-09-24)
binary: rustc
commit-hash: e9385f9eea0221ef295a188d49d16f8f5189abf1
commit-date: 2025-09-24
host: x86_64-unknown-linux-gnu
release: 1.92.0-nightly
LLVM version: 21.1.2

Possibly related line of code:

// errors are being emitted and 2) it leaves the happy path unaffected.
self.fr_static
}
_ => *self
.indices
.get(&r)
.unwrap_or_else(|| bug!("cannot convert `{:?}` to a region vid", r)),
}
}
/// Replaces all free regions in `value` with region vids, as
/// returned by `to_region_vid`.
fn fold_to_region_vids<T>(&self, tcx: TyCtxt<'tcx>, value: T) -> T

Command:
/home/matthias/.rustup/toolchains/master/bin/rustc --edition=2024

Program output

error[E0720]: cannot resolve opaque type
 --> /tmp/icemaker_global_tempdir.aUMoW0s2aYlu/rustc_testrunner_tmpdir_reporting.gv3XOaBfqwDY/mvce.rs:1:24
  |
1 | fn invalid_future() -> impl Future {
  |                        ^^^^^^^^^^^ recursive opaque type
2 |     create_complex_future()
  |     ----------------------- returning here with type `impl Future<Output = impl ReturnsSend>`
...
5 | fn create_complex_future() -> impl Future<Output = impl ReturnsSend> {
  |                               -------------------------------------- returning this opaque type `impl Future<Output = impl ReturnsSend>`

error[E0720]: cannot resolve opaque type
 --> /tmp/icemaker_global_tempdir.aUMoW0s2aYlu/rustc_testrunner_tmpdir_reporting.gv3XOaBfqwDY/mvce.rs:5:31
  |
1 | fn invalid_future() -> impl Future {
  |                        ----------- returning this type `{async block@/tmp/icemaker_global_tempdir.aUMoW0s2aYlu/rustc_testrunner_tmpdir_reporting.gv3XOaBfqwDY/mvce.rs:6:5: 6:10}`
...
5 | fn create_complex_future() -> impl Future<Output = impl ReturnsSend> {
  |                               ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ recursive opaque type
6 |     async { &|| async { invalid_future().await } }
  |     ---------------------------------------------- returning here with type `{async block@/tmp/icemaker_global_tempdir.aUMoW0s2aYlu/rustc_testrunner_tmpdir_reporting.gv3XOaBfqwDY/mvce.rs:6:5: 6:10}`

error: future cannot be sent between threads safely
 --> /tmp/icemaker_global_tempdir.aUMoW0s2aYlu/rustc_testrunner_tmpdir_reporting.gv3XOaBfqwDY/mvce.rs:5:52
  |
5 | fn create_complex_future() -> impl Future<Output = impl ReturnsSend> {
  |                                                    ^^^^^^^^^^^^^^^^ future created by async block is not `Send`
  |
  = note: cannot satisfy `impl Future<Output = impl ReturnsSend>: Send`
note: future is not `Send` as it awaits another future which is not `Send`
 --> /tmp/icemaker_global_tempdir.aUMoW0s2aYlu/rustc_testrunner_tmpdir_reporting.gv3XOaBfqwDY/mvce.rs:6:25
  |
6 |     async { &|| async { invalid_future().await } }
  |                         ^^^^^^^^^^^^^^^^ await occurs here on type `impl Future`, which is not `Send`
note: required by a bound in an opaque type
 --> /tmp/icemaker_global_tempdir.aUMoW0s2aYlu/rustc_testrunner_tmpdir_reporting.gv3XOaBfqwDY/mvce.rs:5:57
  |
5 | fn create_complex_future() -> impl Future<Output = impl ReturnsSend> {
  |                                                         ^^^^^^^^^^^

error: internal compiler error: compiler/rustc_borrowck/src/universal_regions.rs:930:36: cannot convert `'{erased}` to a region vid


thread 'rustc' (814462) panicked at compiler/rustc_borrowck/src/universal_regions.rs:930:36:
Box<dyn Any>
stack backtrace:
   0:     0x7ff7b07ca183 - <std::sys::backtrace::BacktraceLock::print::DisplayBacktrace as core::fmt::Display>::fmt::h4a7ebf3c97b63e54
   1:     0x7ff7b0e02004 - core::fmt::write::h5e5759cada453e98
   2:     0x7ff7b077ea01 - std::io::Write::write_fmt::h503716d2664a2999
   3:     0x7ff7b078fef2 - std::sys::backtrace::BacktraceLock::print::haede8464af6f6593
   4:     0x7ff7b0795e59 - std::panicking::default_hook::{{closure}}::hd1d459f3747276de
   5:     0x7ff7b0795983 - std::panicking::default_hook::h4615f5c23d4bd826
   6:     0x7ff7af7ba5d7 - std[4d5cf81698346de3]::panicking::update_hook::<alloc[62720e50f6bf8d96]::boxed::Box<rustc_driver_impl[743c5953b67fc26f]::install_ice_hook::{closure#1}>>::{closure#0}
   7:     0x7ff7b079627f - std::panicking::panic_with_hook::h290022751dfbc99c
   8:     0x7ff7af7f6861 - std[4d5cf81698346de3]::panicking::begin_panic::<rustc_errors[1d45ad03724e6281]::ExplicitBug>::{closure#0}
   9:     0x7ff7af7eac36 - std[4d5cf81698346de3]::sys::backtrace::__rust_end_short_backtrace::<std[4d5cf81698346de3]::panicking::begin_panic<rustc_errors[1d45ad03724e6281]::ExplicitBug>::{closure#0}, !>
  10:     0x7ff7af7e7b19 - std[4d5cf81698346de3]::panicking::begin_panic::<rustc_errors[1d45ad03724e6281]::ExplicitBug>
  11:     0x7ff7af801f51 - <rustc_errors[1d45ad03724e6281]::diagnostic::BugAbort as rustc_errors[1d45ad03724e6281]::diagnostic::EmissionGuarantee>::emit_producing_guarantee
  12:     0x7ff7afd946ca - rustc_middle[e8cb4ff3ac94f2d4]::util::bug::opt_span_bug_fmt::<rustc_span[80b09b3132128d8d]::span_encoding::Span>::{closure#0}
  13:     0x7ff7afd9488a - rustc_middle[e8cb4ff3ac94f2d4]::ty::context::tls::with_opt::<rustc_middle[e8cb4ff3ac94f2d4]::util::bug::opt_span_bug_fmt<rustc_span[80b09b3132128d8d]::span_encoding::Span>::{closure#0}, !>::{closure#0}
  14:     0x7ff7afd8345b - rustc_middle[e8cb4ff3ac94f2d4]::ty::context::tls::with_context_opt::<rustc_middle[e8cb4ff3ac94f2d4]::ty::context::tls::with_opt<rustc_middle[e8cb4ff3ac94f2d4]::util::bug::opt_span_bug_fmt<rustc_span[80b09b3132128d8d]::span_encoding::Span>::{closure#0}, !>::{closure#0}, !>
  15:     0x7ff7ade7bbd0 - rustc_middle[e8cb4ff3ac94f2d4]::util::bug::bug_fmt
  16:     0x7ff7b175fa36 - <rustc_borrowck[6eb8f1ad86d728a7]::type_check::constraint_conversion::ConstraintConversion>::convert_all
  17:     0x7ff7b148b26d - <rustc_borrowck[6eb8f1ad86d728a7]::type_check::TypeChecker>::fully_perform_op::<(), rustc_borrowck[6eb8f1ad86d728a7]::type_check::InstantiateOpaqueType>
  18:     0x7ff7b1d7ea35 - <rustc_borrowck[6eb8f1ad86d728a7]::type_check::relate_tys::NllTypeRelating>::relate_opaques
  19:     0x7ff7b1e41b37 - <rustc_borrowck[6eb8f1ad86d728a7]::type_check::TypeChecker as rustc_middle[e8cb4ff3ac94f2d4]::mir::visit::Visitor>::visit_body
  20:     0x7ff7b1df6503 - rustc_borrowck[6eb8f1ad86d728a7]::type_check::type_check
  21:     0x7ff7b1ffaa81 - <rustc_borrowck[6eb8f1ad86d728a7]::root_cx::BorrowCheckRootCtxt>::do_mir_borrowck
  22:     0x7ff7b1ff3057 - rustc_borrowck[6eb8f1ad86d728a7]::mir_borrowck
  23:     0x7ff7b1ff2e1d - rustc_query_impl[c5c9f822c73cefb7]::plumbing::__rust_begin_short_backtrace::<rustc_query_impl[c5c9f822c73cefb7]::query_impl::mir_borrowck::dynamic_query::{closure#2}::{closure#0}, rustc_middle[e8cb4ff3ac94f2d4]::query::erase::Erased<[u8; 8usize]>>
  24:     0x7ff7b0fd1644 - rustc_query_system[b5e6460b078a577c]::query::plumbing::try_execute_query::<rustc_query_impl[c5c9f822c73cefb7]::DynamicConfig<rustc_data_structures[a8767abe109b0a96]::vec_cache::VecCache<rustc_span[80b09b3132128d8d]::def_id::LocalDefId, rustc_middle[e8cb4ff3ac94f2d4]::query::erase::Erased<[u8; 8usize]>, rustc_query_system[b5e6460b078a577c]::dep_graph::graph::DepNodeIndex>, false, false, false>, rustc_query_impl[c5c9f822c73cefb7]::plumbing::QueryCtxt, false>
  25:     0x7ff7b0fd5f89 - rustc_query_impl[c5c9f822c73cefb7]::query_impl::mir_borrowck::get_query_non_incr::__rust_end_short_backtrace
  26:     0x7ff7b1e7a011 - rustc_hir_analysis[7f4f1816d2196b28]::collect::type_of::opaque::find_opaque_ty_constraints_for_rpit
  27:     0x7ff7b1e79d8c - rustc_hir_analysis[7f4f1816d2196b28]::collect::type_of::type_of_opaque
  28:     0x7ff7b1e79c91 - rustc_query_impl[c5c9f822c73cefb7]::plumbing::__rust_begin_short_backtrace::<rustc_query_impl[c5c9f822c73cefb7]::query_impl::type_of_opaque::dynamic_query::{closure#2}::{closure#0}, rustc_middle[e8cb4ff3ac94f2d4]::query::erase::Erased<[u8; 8usize]>>
  29:     0x7ff7b0e1af3a - rustc_query_system[b5e6460b078a577c]::query::plumbing::try_execute_query::<rustc_query_impl[c5c9f822c73cefb7]::DynamicConfig<rustc_query_system[b5e6460b078a577c]::query::caches::DefIdCache<rustc_middle[e8cb4ff3ac94f2d4]::query::erase::Erased<[u8; 8usize]>>, false, false, false>, rustc_query_impl[c5c9f822c73cefb7]::plumbing::QueryCtxt, false>
  30:     0x7ff7b2054d9b - rustc_query_impl[c5c9f822c73cefb7]::query_impl::type_of_opaque::get_query_non_incr::__rust_end_short_backtrace
  31:     0x7ff7b173f8d8 - rustc_hir_analysis[7f4f1816d2196b28]::collect::type_of::type_of
  32:     0x7ff7b0e1c2a6 - rustc_query_impl[c5c9f822c73cefb7]::plumbing::__rust_begin_short_backtrace::<rustc_query_impl[c5c9f822c73cefb7]::query_impl::type_of::dynamic_query::{closure#2}::{closure#0}, rustc_middle[e8cb4ff3ac94f2d4]::query::erase::Erased<[u8; 8usize]>>
  33:     0x7ff7b0e1af3a - rustc_query_system[b5e6460b078a577c]::query::plumbing::try_execute_query::<rustc_query_impl[c5c9f822c73cefb7]::DynamicConfig<rustc_query_system[b5e6460b078a577c]::query::caches::DefIdCache<rustc_middle[e8cb4ff3ac94f2d4]::query::erase::Erased<[u8; 8usize]>>, false, false, false>, rustc_query_impl[c5c9f822c73cefb7]::plumbing::QueryCtxt, false>
  34:     0x7ff7b0e1aadd - rustc_query_impl[c5c9f822c73cefb7]::query_impl::type_of::get_query_non_incr::__rust_end_short_backtrace
  35:     0x7ff7b1e7a6ec - rustc_hir_analysis[7f4f1816d2196b28]::check::check::check_opaque
  36:     0x7ff7b1701984 - rustc_hir_analysis[7f4f1816d2196b28]::check::check::check_item_type
  37:     0x7ff7b16f9c39 - rustc_hir_analysis[7f4f1816d2196b28]::check::wfcheck::check_well_formed
  38:     0x7ff7b16f9c1b - rustc_query_impl[c5c9f822c73cefb7]::plumbing::__rust_begin_short_backtrace::<rustc_query_impl[c5c9f822c73cefb7]::query_impl::check_well_formed::dynamic_query::{closure#2}::{closure#0}, rustc_middle[e8cb4ff3ac94f2d4]::query::erase::Erased<[u8; 1usize]>>
  39:     0x7ff7b16f9492 - rustc_query_system[b5e6460b078a577c]::query::plumbing::try_execute_query::<rustc_query_impl[c5c9f822c73cefb7]::DynamicConfig<rustc_data_structures[a8767abe109b0a96]::vec_cache::VecCache<rustc_span[80b09b3132128d8d]::def_id::LocalDefId, rustc_middle[e8cb4ff3ac94f2d4]::query::erase::Erased<[u8; 1usize]>, rustc_query_system[b5e6460b078a577c]::dep_graph::graph::DepNodeIndex>, false, false, false>, rustc_query_impl[c5c9f822c73cefb7]::plumbing::QueryCtxt, false>
  40:     0x7ff7b16f8f96 - rustc_query_impl[c5c9f822c73cefb7]::query_impl::check_well_formed::get_query_non_incr::__rust_end_short_backtrace
  41:     0x7ff7b16f6615 - rustc_hir_analysis[7f4f1816d2196b28]::check::wfcheck::check_type_wf
  42:     0x7ff7b16f64b5 - rustc_query_impl[c5c9f822c73cefb7]::plumbing::__rust_begin_short_backtrace::<rustc_query_impl[c5c9f822c73cefb7]::query_impl::check_type_wf::dynamic_query::{closure#2}::{closure#0}, rustc_middle[e8cb4ff3ac94f2d4]::query::erase::Erased<[u8; 1usize]>>
  43:     0x7ff7b1dc6288 - rustc_query_system[b5e6460b078a577c]::query::plumbing::try_execute_query::<rustc_query_impl[c5c9f822c73cefb7]::DynamicConfig<rustc_query_system[b5e6460b078a577c]::query::caches::SingleCache<rustc_middle[e8cb4ff3ac94f2d4]::query::erase::Erased<[u8; 1usize]>>, false, false, false>, rustc_query_impl[c5c9f822c73cefb7]::plumbing::QueryCtxt, false>
  44:     0x7ff7b1dc604e - rustc_query_impl[c5c9f822c73cefb7]::query_impl::check_type_wf::get_query_non_incr::__rust_end_short_backtrace
  45:     0x7ff7b18e32dc - rustc_hir_analysis[7f4f1816d2196b28]::check_crate
  46:     0x7ff7b0fd2d30 - rustc_interface[e80a289d81ff7a8]::passes::analysis
  47:     0x7ff7b0fd29ed - rustc_query_impl[c5c9f822c73cefb7]::plumbing::__rust_begin_short_backtrace::<rustc_query_impl[c5c9f822c73cefb7]::query_impl::analysis::dynamic_query::{closure#2}::{closure#0}, rustc_middle[e8cb4ff3ac94f2d4]::query::erase::Erased<[u8; 0usize]>>
  48:     0x7ff7b1dcc666 - rustc_query_system[b5e6460b078a577c]::query::plumbing::try_execute_query::<rustc_query_impl[c5c9f822c73cefb7]::DynamicConfig<rustc_query_system[b5e6460b078a577c]::query::caches::SingleCache<rustc_middle[e8cb4ff3ac94f2d4]::query::erase::Erased<[u8; 0usize]>>, false, false, false>, rustc_query_impl[c5c9f822c73cefb7]::plumbing::QueryCtxt, false>
  49:     0x7ff7b1dcc2bc - rustc_query_impl[c5c9f822c73cefb7]::query_impl::analysis::get_query_non_incr::__rust_end_short_backtrace
  50:     0x7ff7b2093e0f - rustc_interface[e80a289d81ff7a8]::passes::create_and_enter_global_ctxt::<core[aa10cf8c11ee53a9]::option::Option<rustc_interface[e80a289d81ff7a8]::queries::Linker>, rustc_driver_impl[743c5953b67fc26f]::run_compiler::{closure#0}::{closure#2}>::{closure#2}::{closure#0}
  51:     0x7ff7b20303fe - rustc_interface[e80a289d81ff7a8]::interface::run_compiler::<(), rustc_driver_impl[743c5953b67fc26f]::run_compiler::{closure#0}>::{closure#1}
  52:     0x7ff7b1f67e78 - std[4d5cf81698346de3]::sys::backtrace::__rust_begin_short_backtrace::<rustc_interface[e80a289d81ff7a8]::util::run_in_thread_with_globals<rustc_interface[e80a289d81ff7a8]::util::run_in_thread_pool_with_globals<rustc_interface[e80a289d81ff7a8]::interface::run_compiler<(), rustc_driver_impl[743c5953b67fc26f]::run_compiler::{closure#0}>::{closure#1}, ()>::{closure#0}, ()>::{closure#0}::{closure#0}, ()>
  53:     0x7ff7b1f67b48 - <<std[4d5cf81698346de3]::thread::Builder>::spawn_unchecked_<rustc_interface[e80a289d81ff7a8]::util::run_in_thread_with_globals<rustc_interface[e80a289d81ff7a8]::util::run_in_thread_pool_with_globals<rustc_interface[e80a289d81ff7a8]::interface::run_compiler<(), rustc_driver_impl[743c5953b67fc26f]::run_compiler::{closure#0}>::{closure#1}, ()>::{closure#0}, ()>::{closure#0}::{closure#0}, ()>::{closure#1} as core[aa10cf8c11ee53a9]::ops::function::FnOnce<()>>::call_once::{shim:vtable#0}
  54:     0x7ff7b1f6dc4d - std::sys::thread::unix::Thread::new::thread_start::hbfb8ed69a8a2081e
  55:     0x7ff7ab8969cb - <unknown>
  56:     0x7ff7ab91aa0c - <unknown>
  57:                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.92.0-nightly (e9385f9ee 2025-09-24) running on x86_64-unknown-linux-gnu

note: compiler flags: -Z dump-mir-dir=dir

query stack during panic:
#0 [mir_borrowck] borrow-checking `coerce_impl_trait`
#1 [type_of_opaque] computing type of opaque `coerce_impl_trait::{opaque#0}`
#2 [type_of] computing type of `coerce_impl_trait::{opaque#0}`
#3 [check_well_formed] checking that `coerce_impl_trait::{opaque#0}` is well-formed
#4 [check_type_wf] checking that types are well-formed
#5 [analysis] running analysis passes on this crate
end of query stack
error: aborting due to 5 previous errors

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

Activity

  1. added
    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.
    C-bugCategory: This is a bug.
    on Sep 24, 2025
  2. added
    needs-triageThis issue may need triage. Remove when done. See docs forge.rust-lang.org/release/issue-triaging
    on Sep 24, 2025
  3. changed the title [-]ICE: `cannot convert `'{erased}` to a region vid`[/-] [+]ICE: `cannot convert '{erased} to a region vid`[/+] on Sep 24, 2025
  4. matthiaskrgr commented on Sep 24, 2025

    @matthiaskrgr
    MemberAuthor

    Regression in nightly-2023-09-24

      commit[0] 2023-09-22: Auto merge of #116077 - matthiaskrgr:rollup-2y1buzg, r=matthiaskrgr
      commit[1] 2023-09-23: Auto merge of #115695 - tmiasko:compiletest-supported-sanitizers, r=oli-obk
      commit[2] 2023-09-23: Auto merge of #116066 - weihanglo:update-cargo, r=weihanglo
      commit[3] 2023-09-23: Auto merge of #116052 - oli-obk:ceci_nest_pas_une_query, r=WaffleLapkin
      commit[4] 2023-09-23: Auto merge of #116071 - estebank:issue-115905, r=compiler-errors
      commit[5] 2023-09-23: Auto merge of #116045 - notriddle:notriddle/issue-83556, r=cjgillot
      commit[6] 2023-09-23: Auto merge of #116081 - compiler-errors:closure-captures-sized, r=cjgillot
      commit[7] 2023-09-23: Auto merge of #116047 - a-lafrance:I80836-codegen-test, r=Mark-Simulacrum
      commit[8] 2023-09-23: Auto merge of #107421 - cjgillot:drop-tracking-mir, r=oli-obk
    

    could be #116081 maybe?

  5. added
    S-has-mcveStatus: A Minimal Complete and Verifiable Example has been found for this issue
    and removed
    needs-triageThis issue may need triage. Remove when done. See docs forge.rust-lang.org/release/issue-triaging
    on Dec 30, 2025
  6. added
    E-needs-testCall for participation: An issue has been fixed and does not reproduce, but no test has been added.
    on Feb 25, 2026
  7. reddevilmidzy commented on Feb 25, 2026

    @reddevilmidzy
    Member

    fixed: #152327

  8. added
    -Zvalidate-mirUnstable option: MIR validation
    WG-trait-system-refactorThe Rustc Trait System Refactor Initiative (-Znext-solver)
    and removed
    E-needs-testCall for participation: An issue has been fixed and does not reproduce, but no test has been added.
    on Feb 27, 2026
  9. matthiaskrgr commented on Feb 27, 2026

    @matthiaskrgr
    MemberAuthor

    still getting a crash on this with the next solver:

    auto-reduced (treereduce-rust):

    //@compile-flags: --edition=2024 -Zvalidate-mir -Znext-solver=globally
    fn invalid_future() -> impl Future {}
    
    fn create_complex_future() -> impl Future {
        async { &|| async { invalid_future().await } }
    }

    original:

    fn invalid_future() -> impl Future {
        create_complex_future()
    }
    
    fn create_complex_future() -> impl Future<Output = impl ReturnsSend> {
        async { &|| async { invalid_future().await } }
    }
    
    fn coerce_impl_trait() -> impl Future<Output = impl Send> {
        create_complex_future()
    }
    
    trait ReturnsSend {}
    
    impl<F, R> ReturnsSend for F
    where
        F: Fn() -> R,
        R: Send,
    {
    }
    
    fn main() {}

    Version information

    rustc 1.95.0-nightly (3a70d0349 2026-02-27)
    binary: rustc
    commit-hash: 3a70d0349fa378a10c3748f1a48742e61505020f
    commit-date: 2026-02-27
    host: x86_64-unknown-linux-gnu
    release: 1.95.0-nightly
    LLVM version: 22.1.0
    
    

    Possibly related line of code:

    fn normalize_generic_arg_after_erasing_regions(
    &self,
    arg: ty::GenericArg<'tcx>,
    ) -> ty::GenericArg<'tcx> {
    let arg = self.typing_env.as_query_input(arg);
    self.tcx.try_normalize_generic_arg_after_erasing_regions(arg).unwrap_or_else(|_| {
    bug!(
    "Failed to normalize {:?} in typing_env={:?}, \
    maybe try to call `try_normalize_erasing_regions` instead",
    arg.value,
    self.typing_env,
    )
    })

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

    Program output

    error[E0601]: `main` function not found in crate `mvce`
     --> /tmp/icemaker_global_tempdir.MZbRNPjLjnQY/rustc_testrunner_tmpdir_reporting.CgSiyFkJoRmq/mvce.rs:5:2
      |
    5 | }
      |  ^ consider adding a `main` function to `/tmp/icemaker_global_tempdir.MZbRNPjLjnQY/rustc_testrunner_tmpdir_reporting.CgSiyFkJoRmq/mvce.rs`
    
    error[E0277]: `()` is not a future
     --> /tmp/icemaker_global_tempdir.MZbRNPjLjnQY/rustc_testrunner_tmpdir_reporting.CgSiyFkJoRmq/mvce.rs:1:24
      |
    1 | fn invalid_future() -> impl Future {}
      |                        ^^^^^^^^^^^ `()` is not a future
      |
      = help: the trait `Future` is not implemented for `()`
    
    error: internal compiler error: /rustc-dev/3a70d0349fa378a10c3748f1a48742e61505020f/compiler/rustc_middle/src/ty/normalize_erasing_regions.rs:171:13: Failed to normalize &'{erased} Closure(DefId(0:8 ~ mvce[6520]::create_complex_future::{closure#0}::{closure#0}), [i8, Binder { value: extern "RustCall" fn(()) -> Coroutine(DefId(0:9 ~ mvce[6520]::create_complex_future::{closure#0}::{closure#0}::{closure#0}), [(), std::future::ResumeTy, (), Alias(Projection, AliasTy { args: [Alias(Opaque, AliasTy { args: [], def_id: DefId(0:4 ~ mvce[6520]::invalid_future::{opaque#0}), .. })], def_id: DefId(2:52868 ~ core[541f]::future::future::Future::Output), .. }), ()]), bound_vars: [] }, ()]) in typing_env=TypingEnv { typing_mode: PostAnalysis, param_env: ParamEnv { caller_bounds: [] } }, maybe try to call `try_normalize_erasing_regions` instead
    
    
    thread 'rustc' (1589168) panicked at /rustc-dev/3a70d0349fa378a10c3748f1a48742e61505020f/compiler/rustc_middle/src/ty/normalize_erasing_regions.rs:171:13:
    Box<dyn Any>
    stack backtrace:
       0:     0x7f88e738edbb - <<std[31ff84e99a7a8ead]::sys::backtrace::BacktraceLock>::print::DisplayBacktrace as core[541fdf89a9632946]::fmt::Display>::fmt
       1:     0x7f88e7a20308 - core[541fdf89a9632946]::fmt::write
       2:     0x7f88e73a5dc6 - <std[31ff84e99a7a8ead]::sys::stdio::unix::Stderr as std[31ff84e99a7a8ead]::io::Write>::write_fmt
       3:     0x7f88e7364e98 - std[31ff84e99a7a8ead]::panicking::default_hook::{closure#0}
       4:     0x7f88e7382223 - std[31ff84e99a7a8ead]::panicking::default_hook
       5:     0x7f88e6364f10 - std[31ff84e99a7a8ead]::panicking::update_hook::<alloc[650d1a802a99d584]::boxed::Box<rustc_driver_impl[d9c9a532171ebae0]::install_ice_hook::{closure#1}>>::{closure#0}
       6:     0x7f88e7382502 - std[31ff84e99a7a8ead]::panicking::panic_with_hook
       7:     0x7f88e6395f21 - std[31ff84e99a7a8ead]::panicking::begin_panic::<rustc_errors[f8b02e2b8728ed6a]::ExplicitBug>::{closure#0}
       8:     0x7f88e638eac6 - std[31ff84e99a7a8ead]::sys::backtrace::__rust_end_short_backtrace::<std[31ff84e99a7a8ead]::panicking::begin_panic<rustc_errors[f8b02e2b8728ed6a]::ExplicitBug>::{closure#0}, !>
       9:     0x7f88e638c868 - std[31ff84e99a7a8ead]::panicking::begin_panic::<rustc_errors[f8b02e2b8728ed6a]::ExplicitBug>
      10:     0x7f88e63a0fb1 - <rustc_errors[f8b02e2b8728ed6a]::diagnostic::BugAbort as rustc_errors[f8b02e2b8728ed6a]::diagnostic::EmissionGuarantee>::emit_producing_guarantee
      11:     0x7f88e6975689 - rustc_middle[f47881f46f7915ce]::util::bug::opt_span_bug_fmt::<rustc_span[99e019a6fa3a3929]::span_encoding::Span>::{closure#0}
      12:     0x7f88e6975812 - rustc_middle[f47881f46f7915ce]::ty::context::tls::with_opt::<rustc_middle[f47881f46f7915ce]::util::bug::opt_span_bug_fmt<rustc_span[99e019a6fa3a3929]::span_encoding::Span>::{closure#0}, !>::{closure#0}
      13:     0x7f88e696689b - rustc_middle[f47881f46f7915ce]::ty::context::tls::with_context_opt::<rustc_middle[f47881f46f7915ce]::ty::context::tls::with_opt<rustc_middle[f47881f46f7915ce]::util::bug::opt_span_bug_fmt<rustc_span[99e019a6fa3a3929]::span_encoding::Span>::{closure#0}, !>::{closure#0}, !>
      14:     0x7f88e3e9ecc4 - rustc_middle[f47881f46f7915ce]::util::bug::bug_fmt
      15:     0x7f88e85cf5eb - <rustc_middle[f47881f46f7915ce]::ty::normalize_erasing_regions::NormalizeAfterErasingRegionsFolder as rustc_type_ir[ed1dcd5ae5e723d7]::fold::TypeFolder<rustc_middle[f47881f46f7915ce]::ty::context::TyCtxt>>::fold_ty
      16:     0x7f88e875de36 - rustc_mir_transform[21ed693f9430994b]::validate::validate_types
      17:     0x7f88e8741cb3 - <rustc_mir_transform[21ed693f9430994b]::validate::Validator as rustc_mir_transform[21ed693f9430994b]::pass_manager::MirPass>::run_pass
      18:     0x7f88e5b1daa5 - rustc_mir_transform[21ed693f9430994b]::pass_manager::validate_body
      19:     0x7f88e7a0d964 - rustc_mir_transform[21ed693f9430994b]::run_analysis_to_runtime_passes
      20:     0x7f88e8799b84 - rustc_mir_transform[21ed693f9430994b]::mir_drops_elaborated_and_const_checked
      21:     0x7f88e87995d9 - rustc_query_impl[10c474e00055ca18]::query_impl::mir_drops_elaborated_and_const_checked::invoke_provider_fn::__rust_begin_short_backtrace
      22:     0x7f88e7b6748a - rustc_query_impl[10c474e00055ca18]::execution::try_execute_query::<rustc_data_structures[6b769a1dd6b8c594]::vec_cache::VecCache<rustc_span[99e019a6fa3a3929]::def_id::LocalDefId, rustc_middle[f47881f46f7915ce]::query::erase::ErasedData<[u8; 8usize]>, rustc_middle[f47881f46f7915ce]::dep_graph::graph::DepNodeIndex>, false>
      23:     0x7f88e7b66bc3 - rustc_query_impl[10c474e00055ca18]::query_impl::mir_drops_elaborated_and_const_checked::execute_query_non_incr::__rust_end_short_backtrace
      24:     0x7f88e7b64f48 - <rustc_middle[f47881f46f7915ce]::ty::context::TyCtxt>::par_hir_body_owners::<rustc_interface[4731d672126a0531]::passes::run_required_analyses::{closure#1}::{closure#0}>::{closure#0}
      25:     0x7f88e7b6432f - rustc_interface[4731d672126a0531]::passes::analysis
      26:     0x7f88e8c7fd1a - rustc_query_impl[10c474e00055ca18]::execution::try_execute_query::<rustc_middle[f47881f46f7915ce]::query::caches::SingleCache<rustc_middle[f47881f46f7915ce]::query::erase::ErasedData<[u8; 0usize]>>, false>
      27:     0x7f88e8c7fae9 - rustc_query_impl[10c474e00055ca18]::query_impl::analysis::execute_query_non_incr::__rust_end_short_backtrace
      28:     0x7f88e8c5e1ad - rustc_interface[4731d672126a0531]::interface::run_compiler::<(), rustc_driver_impl[d9c9a532171ebae0]::run_compiler::{closure#0}>::{closure#1}
      29:     0x7f88e8c442be - std[31ff84e99a7a8ead]::sys::backtrace::__rust_begin_short_backtrace::<rustc_interface[4731d672126a0531]::util::run_in_thread_with_globals<rustc_interface[4731d672126a0531]::util::run_in_thread_pool_with_globals<rustc_interface[4731d672126a0531]::interface::run_compiler<(), rustc_driver_impl[d9c9a532171ebae0]::run_compiler::{closure#0}>::{closure#1}, ()>::{closure#0}, ()>::{closure#0}::{closure#0}, ()>
      30:     0x7f88e8c44920 - <std[31ff84e99a7a8ead]::thread::lifecycle::spawn_unchecked<rustc_interface[4731d672126a0531]::util::run_in_thread_with_globals<rustc_interface[4731d672126a0531]::util::run_in_thread_pool_with_globals<rustc_interface[4731d672126a0531]::interface::run_compiler<(), rustc_driver_impl[d9c9a532171ebae0]::run_compiler::{closure#0}>::{closure#1}, ()>::{closure#0}, ()>::{closure#0}::{closure#0}, ()>::{closure#1} as core[541fdf89a9632946]::ops::function::FnOnce<()>>::call_once::{shim:vtable#0}
      31:     0x7f88e8c457ac - <std[31ff84e99a7a8ead]::sys::thread::unix::Thread>::new::thread_start
      32:     0x7f88e265e98b - <unknown>
      33:     0x7f88e26e2a0c - <unknown>
      34:                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 (3a70d0349 2026-02-27) running on x86_64-unknown-linux-gnu
    
    note: compiler flags: -Z validate-mir -Z next-solver=globally -Z dump-mir-dir=dir
    
    query stack during panic:
    #0 [mir_drops_elaborated_and_const_checked] elaborating drops for `create_complex_future::{closure#0}`
    #1 [analysis] running analysis passes on crate `mvce`
    end of query stack
    error: internal compiler error: /rustc-dev/3a70d0349fa378a10c3748f1a48742e61505020f/compiler/rustc_middle/src/ty/normalize_erasing_regions.rs:171:13: Failed to normalize Alias(Projection, AliasTy { args: [Alias(Opaque, AliasTy { args: [], def_id: DefId(0:4 ~ mvce[6520]::invalid_future::{opaque#0}), .. })], def_id: DefId(2:52868 ~ core[541f]::future::future::Future::Output), .. }) in typing_env=TypingEnv { typing_mode: PostAnalysis, param_env: ParamEnv { caller_bounds: [] } }, maybe try to call `try_normalize_erasing_regions` instead
    
    
    thread 'rustc' (1589168) panicked at /rustc-dev/3a70d0349fa378a10c3748f1a48742e61505020f/compiler/rustc_middle/src/ty/normalize_erasing_regions.rs:171:13:
    Box<dyn Any>
    stack backtrace:
       0:     0x7f88e738edbb - <<std[31ff84e99a7a8ead]::sys::backtrace::BacktraceLock>::print::DisplayBacktrace as core[541fdf89a9632946]::fmt::Display>::fmt
       1:     0x7f88e7a20308 - core[541fdf89a9632946]::fmt::write
       2:     0x7f88e73a5dc6 - <std[31ff84e99a7a8ead]::sys::stdio::unix::Stderr as std[31ff84e99a7a8ead]::io::Write>::write_fmt
       3:     0x7f88e7364e98 - std[31ff84e99a7a8ead]::panicking::default_hook::{closure#0}
       4:     0x7f88e7382223 - std[31ff84e99a7a8ead]::panicking::default_hook
       5:     0x7f88e6364f10 - std[31ff84e99a7a8ead]::panicking::update_hook::<alloc[650d1a802a99d584]::boxed::Box<rustc_driver_impl[d9c9a532171ebae0]::install_ice_hook::{closure#1}>>::{closure#0}
       6:     0x7f88e7382502 - std[31ff84e99a7a8ead]::panicking::panic_with_hook
       7:     0x7f88e6395f21 - std[31ff84e99a7a8ead]::panicking::begin_panic::<rustc_errors[f8b02e2b8728ed6a]::ExplicitBug>::{closure#0}
       8:     0x7f88e638eac6 - std[31ff84e99a7a8ead]::sys::backtrace::__rust_end_short_backtrace::<std[31ff84e99a7a8ead]::panicking::begin_panic<rustc_errors[f8b02e2b8728ed6a]::ExplicitBug>::{closure#0}, !>
       9:     0x7f88e638c868 - std[31ff84e99a7a8ead]::panicking::begin_panic::<rustc_errors[f8b02e2b8728ed6a]::ExplicitBug>
      10:     0x7f88e63a0fb1 - <rustc_errors[f8b02e2b8728ed6a]::diagnostic::BugAbort as rustc_errors[f8b02e2b8728ed6a]::diagnostic::EmissionGuarantee>::emit_producing_guarantee
      11:     0x7f88e6975689 - rustc_middle[f47881f46f7915ce]::util::bug::opt_span_bug_fmt::<rustc_span[99e019a6fa3a3929]::span_encoding::Span>::{closure#0}
      12:     0x7f88e6975812 - rustc_middle[f47881f46f7915ce]::ty::context::tls::with_opt::<rustc_middle[f47881f46f7915ce]::util::bug::opt_span_bug_fmt<rustc_span[99e019a6fa3a3929]::span_encoding::Span>::{closure#0}, !>::{closure#0}
      13:     0x7f88e696689b - rustc_middle[f47881f46f7915ce]::ty::context::tls::with_context_opt::<rustc_middle[f47881f46f7915ce]::ty::context::tls::with_opt<rustc_middle[f47881f46f7915ce]::util::bug::opt_span_bug_fmt<rustc_span[99e019a6fa3a3929]::span_encoding::Span>::{closure#0}, !>::{closure#0}, !>
      14:     0x7f88e3e9ecc4 - rustc_middle[f47881f46f7915ce]::util::bug::bug_fmt
      15:     0x7f88e85cf5eb - <rustc_middle[f47881f46f7915ce]::ty::normalize_erasing_regions::NormalizeAfterErasingRegionsFolder as rustc_type_ir[ed1dcd5ae5e723d7]::fold::TypeFolder<rustc_middle[f47881f46f7915ce]::ty::context::TyCtxt>>::fold_ty
      16:     0x7f88e875de36 - rustc_mir_transform[21ed693f9430994b]::validate::validate_types
      17:     0x7f88e8741cb3 - <rustc_mir_transform[21ed693f9430994b]::validate::Validator as rustc_mir_transform[21ed693f9430994b]::pass_manager::MirPass>::run_pass
      18:     0x7f88e5b1daa5 - rustc_mir_transform[21ed693f9430994b]::pass_manager::validate_body
      19:     0x7f88e7a0d964 - rustc_mir_transform[21ed693f9430994b]::run_analysis_to_runtime_passes
      20:     0x7f88e8799b84 - rustc_mir_transform[21ed693f9430994b]::mir_drops_elaborated_and_const_checked
      21:     0x7f88e87995d9 - rustc_query_impl[10c474e00055ca18]::query_impl::mir_drops_elaborated_and_const_checked::invoke_provider_fn::__rust_begin_short_backtrace
      22:     0x7f88e7b6748a - rustc_query_impl[10c474e00055ca18]::execution::try_execute_query::<rustc_data_structures[6b769a1dd6b8c594]::vec_cache::VecCache<rustc_span[99e019a6fa3a3929]::def_id::LocalDefId, rustc_middle[f47881f46f7915ce]::query::erase::ErasedData<[u8; 8usize]>, rustc_middle[f47881f46f7915ce]::dep_graph::graph::DepNodeIndex>, false>
      23:     0x7f88e7b66bc3 - rustc_query_impl[10c474e00055ca18]::query_impl::mir_drops_elaborated_and_const_checked::execute_query_non_incr::__rust_end_short_backtrace
      24:     0x7f88e7b64f48 - <rustc_middle[f47881f46f7915ce]::ty::context::TyCtxt>::par_hir_body_owners::<rustc_interface[4731d672126a0531]::passes::run_required_analyses::{closure#1}::{closure#0}>::{closure#0}
      25:     0x7f88e7b6432f - rustc_interface[4731d672126a0531]::passes::analysis
      26:     0x7f88e8c7fd1a - rustc_query_impl[10c474e00055ca18]::execution::try_execute_query::<rustc_middle[f47881f46f7915ce]::query::caches::SingleCache<rustc_middle[f47881f46f7915ce]::query::erase::ErasedData<[u8; 0usize]>>, false>
      27:     0x7f88e8c7fae9 - rustc_query_impl[10c474e00055ca18]::query_impl::analysis::execute_query_non_incr::__rust_end_short_backtrace
      28:     0x7f88e8c5e1ad - rustc_interface[4731d672126a0531]::interface::run_compiler::<(), rustc_driver_impl[d9c9a532171ebae0]::run_compiler::{closure#0}>::{closure#1}
      29:     0x7f88e8c442be - std[31ff84e99a7a8ead]::sys::backtrace::__rust_begin_short_backtrace::<rustc_interface[4731d672126a0531]::util::run_in_thread_with_globals<rustc_interface[4731d672126a0531]::util::run_in_thread_pool_with_globals<rustc_interface[4731d672126a0531]::interface::run_compiler<(), rustc_driver_impl[d9c9a532171ebae0]::run_compiler::{closure#0}>::{closure#1}, ()>::{closure#0}, ()>::{closure#0}::{closure#0}, ()>
      30:     0x7f88e8c44920 - <std[31ff84e99a7a8ead]::thread::lifecycle::spawn_unchecked<rustc_interface[4731d672126a0531]::util::run_in_thread_with_globals<rustc_interface[4731d672126a0531]::util::run_in_thread_pool_with_globals<rustc_interface[4731d672126a0531]::interface::run_compiler<(), rustc_driver_impl[d9c9a532171ebae0]::run_compiler::{closure#0}>::{closure#1}, ()>::{closure#0}, ()>::{closure#0}::{closure#0}, ()>::{closure#1} as core[541fdf89a9632946]::ops::function::FnOnce<()>>::call_once::{shim:vtable#0}
      31:     0x7f88e8c457ac - <std[31ff84e99a7a8ead]::sys::thread::unix::Thread>::new::thread_start
      32:     0x7f88e265e98b - <unknown>
      33:     0x7f88e26e2a0c - <unknown>
      34:                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 (3a70d0349 2026-02-27) running on x86_64-unknown-linux-gnu
    
    note: compiler flags: -Z validate-mir -Z next-solver=globally -Z dump-mir-dir=dir
    
    query stack during panic:
    #0 [mir_drops_elaborated_and_const_checked] elaborating drops for `create_complex_future::{closure#0}::{closure#0}::{closure#0}`
    #1 [analysis] running analysis passes on crate `mvce`
    end of query stack
    error: aborting due to 4 previous errors
    
    Some errors have detailed explanations: E0277, E0601.
    For more information about an error, try `rustc --explain E0277`.
    
    

    @rustbot label +-Zvalidate-mir +WG-trait-system-refactor

  10. RodBurman commented on Mar 8, 2026

    @RodBurman

    Current version:

    % rustc -v -V
    rustc 1.96.0-nightly (69370dc 2026-03-05)
    binary: rustc
    commit-hash: 69370dc
    commit-date: 2026-03-05
    host: aarch64-apple-darwin
    release: 1.96.0-nightly
    LLVM version: 22.1.0

    Still crashes with substantially the same errors and traceback.

  11. lcnr commented on Oct 8, 2026

    @lcnr
    Contributor

    this no longer fails. should figure out the PR which fixed the second example and then maybe add it as a test

  12. added
    E-needs-testCall for participation: An issue has been fixed and does not reproduce, but no test has been added.
    E-needs-bisectionCall for participation: This issue needs bisection: https://github.com/rust-lang/cargo-bisect-rustc
    on Oct 8, 2026
  13. zakrad commented on Oct 13, 2026

    @zakrad
    Contributor

    The next solver ICE was fixed by #156742. It's the same "Failed to normalize" ICE as #151299, which already has a test

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

    -Zvalidate-mirUnstable option: MIR validationC-bugCategory: This is a bug.E-needs-bisectionCall for participation: This issue needs bisection: https://github.com/rust-lang/cargo-bisect-rustcE-needs-testCall for participation: An issue has been fixed and does not reproduce, but no test has been added.I-ICEIssue: The compiler panicked, giving an Internal Compilation Error (ICE) ❄️S-has-mcveStatus: A Minimal Complete and Verifiable Example has been found for this issueT-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)

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions