Repository: rust
Issue: Failed to normalize `sp_std::rc::Rc<sp_std::prelude::Box...>` maybe try to call `try_normalize_erasing_regions` instead
Labels: I-ICE,T-compiler,C-bug,E-needs-bisection

[rustc-ice-2024-09-23T12_11_53-34162.txt](https://github.com/user-attachments/files/17097370/rustc-ice-2024-09-23T12_11_53-34162.txt)
<!--
Thank you for finding an Internal Compiler Error! 🧊  If possible, try to provide
a minimal verifiable example. You can read "Rust Bug Minimization Patterns" for
how to create smaller examples.
http://blog.pnkfx.org/blog/2019/11/18/rust-bug-minimization-patterns/
-->

### Code

https://github.com/paritytech/polkadot-sdk/blob/b9eb68bcb5ab93e58bcba4425975ad00374da2bc/substrate/frame/system/src/lib.rs#L448-L636


### Meta
<!--
If you're using the stable version of the compiler, you should also check if the
bug also exists in the beta or nightly versions.
-->

`rustc --version --verbose`:
```
rustc 1.81.0 (eeb90cda1 2024-09-04)
binary: rustc
commit-hash: eeb90cda1969383f56a2637cbd3037bdf598841c
commit-date: 2024-09-04
host: aarch64-apple-darwin
release: 1.81.0
LLVM version: 18.1.7
```

### Error output

```
compiler/rustc_middle/src/ty/normalize_erasing_regions.rs:168:90: Failed to normalize sp_std::rc::Rc<sp_std::prelude::Box<dyn [Binder { value: Trait(core::ops::Fn<(&<Runtime as frame_system::Config>::RuntimeCall,)>), bound_vars: [Region(BrAnon)] }, Binder { value: Projection(Output = bool), bound_vars: [Region(BrAnon)] }] + '{erased}, sp_std::alloc::alloc::Global>, sp_std::alloc::alloc::Global>, maybe try to call `try_normalize_erasing_regions` instead

```

<!--
Include a backtrace in the code block by setting `RUST_BACKTRACE=1` in your
environment. E.g. `RUST_BACKTRACE=1 cargo build`.
-->
<details><summary><strong>Backtrace</strong></summary>
<p>

```
 0:        0x1052ab73c - <std::sys::backtrace::BacktraceLock::print::DisplayBacktrace as core::fmt::Display>::fmt::h243268f17d714c7f
     1:        0x1052ee688 - core::fmt::write::hb3cfb8a30e72d7ff
     2:        0x1052a1720 - std::io::Write::write_fmt::hfb2314975de9ecf1
     3:        0x1052adc4c - std::panicking::default_hook::{{closure}}::h14c7718ccf39d316
     4:        0x1052ad870 - std::panicking::default_hook::hc62e60da3be2f352
     5:        0x10eea45b8 - <alloc[47bc6d386d7ae45f]::boxed::Box<rustc_driver_impl[54c40c94c6cfc0b2]::install_ice_hook::{closure#0}> as core[f827f14b5e761a5d]::ops::function::Fn<(&dyn for<'a, 'b> core[f827f14b5e761a5d]::ops::function::Fn<(&'a std[4f7d7c3ef984657a]::panic::PanicHookInfo<'b>,), Output = ()> + core[f827f14b5e761a5d]::marker::Sync + core[f827f14b5e761a5d]::marker::Send, &std[4f7d7c3ef984657a]::panic::PanicHookInfo)>>::call
     6:        0x1052ae868 - std::panicking::rust_panic_with_hook::h09e8a656f11e82b2
     7:        0x10ef3327c - std[4f7d7c3ef984657a]::panicking::begin_panic::<rustc_errors[886d83f994b4d71c]::ExplicitBug>::{closure#0}
     8:        0x10ef302b0 - std[4f7d7c3ef984657a]::sys::backtrace::__rust_end_short_backtrace::<std[4f7d7c3ef984657a]::panicking::begin_panic<rustc_errors[886d83f994b4d71c]::ExplicitBug>::{closure#0}, !>
     9:        0x113212960 - std[4f7d7c3ef984657a]::panicking::begin_panic::<rustc_errors[886d83f994b4d71c]::ExplicitBug>
    10:        0x10ef4651c - <rustc_errors[886d83f994b4d71c]::diagnostic::BugAbort as rustc_errors[886d83f994b4d71c]::diagnostic::EmissionGuarantee>::emit_producing_guarantee
    11:        0x10fb4a26c - rustc_middle[5a798f9924bfd2e0]::util::bug::opt_span_bug_fmt::<rustc_span[ab16d476329f5d04]::span_encoding::Span>::{closure#0}
    12:        0x10fb48ef8 - rustc_middle[5a798f9924bfd2e0]::ty::context::tls::with_opt::<rustc_middle[5a798f9924bfd2e0]::util::bug::opt_span_bug_fmt<rustc_span[ab16d476329f5d04]::span_encoding::Span>::{closure#0}, !>::{closure#0}
    13:        0x10fb48ec4 - rustc_middle[5a798f9924bfd2e0]::ty::context::tls::with_context_opt::<rustc_middle[5a798f9924bfd2e0]::ty::context::tls::with_opt<rustc_middle[5a798f9924bfd2e0]::util::bug::opt_span_bug_fmt<rustc_span[ab16d476329f5d04]::span_encoding::Span>::{closure#0}, !>::{closure#0}, !>
    14:        0x1132b07e8 - rustc_middle[5a798f9924bfd2e0]::util::bug::bug_fmt
    15:        0x10fe527a0 - <rustc_middle[5a798f9924bfd2e0]::ty::context::TyCtxt>::normalize_erasing_regions::<rustc_middle[5a798f9924bfd2e0]::ty::Ty>
    16:        0x10fecb028 - <core[f827f14b5e761a5d]::iter::adapters::map::Map<core[f827f14b5e761a5d]::iter::adapters::enumerate::Enumerate<core[f827f14b5e761a5d]::slice::iter::Iter<rustc_middle[5a798f9924bfd2e0]::ty::FieldDef>>, <rustc_mir_dataflow[dc82ff89d62403a5]::elaborate_drops::DropCtxt<rustc_mir_transform[ed8a8c9edc8f1ca0]::elaborate_drops::Elaborator>>::move_paths_for_fields::{closure#0}> as core[f827f14b5e761a5d]::iter::traits::iterator::Iterator>::fold::<(), core[f827f14b5e761a5d]::iter::traits::iterator::Iterator::for_each::call<(rustc_middle[5a798f9924bfd2e0]::mir::syntax::Place, core[f827f14b5e761a5d]::option::Option<rustc_mir_dataflow[dc82ff89d62403a5]::move_paths::MovePathIndex>), <alloc[47bc6d386d7ae45f]::vec::Vec<(rustc_middle[5a798f9924bfd2e0]::mir::syntax::Place, core[f827f14b5e761a5d]::option::Option<rustc_mir_dataflow[dc82ff89d62403a5]::move_paths::MovePathIndex>)>>::extend_trusted<core[f827f14b5e761a5d]::iter::adapters::map::Map<core[f827f14b5e761a5d]::iter::adapters::enumerate::Enumerate<core[f827f14b5e761a5d]::slice::iter::Iter<rustc_middle[5a798f9924bfd2e0]::ty::FieldDef>>, <rustc_mir_dataflow[dc82ff89d62403a5]::elaborate_drops::DropCtxt<rustc_mir_transform[ed8a8c9edc8f1ca0]::elaborate_drops::Elaborator>>::move_paths_for_fields::{closure#0}>>::{closure#0}>::{closure#0}>
    17:        0x10fd8899c - <alloc[47bc6d386d7ae45f]::vec::Vec<(rustc_middle[5a798f9924bfd2e0]::mir::syntax::Place, core[f827f14b5e761a5d]::option::Option<rustc_mir_dataflow[dc82ff89d62403a5]::move_paths::MovePathIndex>)> as alloc[47bc6d386d7ae45f]::vec::spec_from_iter::SpecFromIter<(rustc_middle[5a798f9924bfd2e0]::mir::syntax::Place, core[f827f14b5e761a5d]::option::Option<rustc_mir_dataflow[dc82ff89d62403a5]::move_paths::MovePathIndex>), core[f827f14b5e761a5d]::iter::adapters::map::Map<core[f827f14b5e761a5d]::iter::adapters::enumerate::Enumerate<core[f827f14b5e761a5d]::slice::iter::Iter<rustc_middle[5a798f9924bfd2e0]::ty::FieldDef>>, <rustc_mir_dataflow[dc82ff89d62403a5]::elaborate_drops::DropCtxt<rustc_mir_transform[ed8a8c9edc8f1ca0]::elaborate_drops::Elaborator>>::move_paths_for_fields::{closure#0}>>>::from_iter
    18:        0x10fde9d94 - <rustc_mir_dataflow[dc82ff89d62403a5]::elaborate_drops::DropCtxt<rustc_mir_transform[ed8a8c9edc8f1ca0]::elaborate_drops::Elaborator>>::open_drop_for_adt_contents
    19:        0x10fde8eb8 - <rustc_mir_dataflow[dc82ff89d62403a5]::elaborate_drops::DropCtxt<rustc_mir_transform[ed8a8c9edc8f1ca0]::elaborate_drops::Elaborator>>::elaborate_drop
    20:        0x10fdf5fc8 - <rustc_mir_transform[ed8a8c9edc8f1ca0]::elaborate_drops::ElaborateDrops as rustc_middle[5a798f9924bfd2e0]::mir::MirPass>::run_pass
    21:        0x10fd638f4 - rustc_mir_transform[ed8a8c9edc8f1ca0]::pass_manager::run_passes_inner
    22:        0x10fe6bda0 - rustc_mir_transform[ed8a8c9edc8f1ca0]::run_analysis_to_runtime_passes
    23:        0x10fe6ba5c - rustc_mir_transform[ed8a8c9edc8f1ca0]::mir_drops_elaborated_and_const_checked
    24:        0x110312668 - rustc_query_impl[5e7782f17777a7c9]::plumbing::__rust_begin_short_backtrace::<rustc_query_impl[5e7782f17777a7c9]::query_impl::mir_drops_elaborated_and_const_checked::dynamic_query::{closure#2}::{closure#0}, rustc_middle[5a798f9924bfd2e0]::query::erase::Erased<[u8; 8usize]>>
    25:        0x11035fac0 - <rustc_query_impl[5e7782f17777a7c9]::query_impl::mir_drops_elaborated_and_const_checked::dynamic_query::{closure#2} as core[f827f14b5e761a5d]::ops::function::FnOnce<(rustc_middle[5a798f9924bfd2e0]::ty::context::TyCtxt, rustc_span[ab16d476329f5d04]::def_id::LocalDefId)>>::call_once
    26:        0x1102c1304 - rustc_query_system[5f1672c0485b57da]::query::plumbing::try_execute_query::<rustc_query_impl[5e7782f17777a7c9]::DynamicConfig<rustc_query_system[5f1672c0485b57da]::query::caches::VecCache<rustc_span[ab16d476329f5d04]::def_id::LocalDefId, rustc_middle[5a798f9924bfd2e0]::query::erase::Erased<[u8; 8usize]>>, false, false, false>, rustc_query_impl[5e7782f17777a7c9]::plumbing::QueryCtxt, false>
    27:        0x11038e3e4 - rustc_query_impl[5e7782f17777a7c9]::query_impl::mir_drops_elaborated_and_const_checked::get_query_non_incr::__rust_end_short_backtrace
    28:        0x10f73b264 - rustc_interface[1340bb505392beac]::passes::analysis
    29:        0x110312df8 - rustc_query_impl[5e7782f17777a7c9]::plumbing::__rust_begin_short_backtrace::<rustc_query_impl[5e7782f17777a7c9]::query_impl::analysis::dynamic_query::{closure#2}::{closure#0}, rustc_middle[5a798f9924bfd2e0]::query::erase::Erased<[u8; 1usize]>>
    30:        0x1103618ac - <rustc_query_impl[5e7782f17777a7c9]::query_impl::analysis::dynamic_query::{closure#2} as core[f827f14b5e761a5d]::ops::function::FnOnce<(rustc_middle[5a798f9924bfd2e0]::ty::context::TyCtxt, ())>>::call_once
    31:        0x110278348 - rustc_query_system[5f1672c0485b57da]::query::plumbing::try_execute_query::<rustc_query_impl[5e7782f17777a7c9]::DynamicConfig<rustc_query_system[5f1672c0485b57da]::query::caches::SingleCache<rustc_middle[5a798f9924bfd2e0]::query::erase::Erased<[u8; 1usize]>>, false, false, false>, rustc_query_impl[5e7782f17777a7c9]::plumbing::QueryCtxt, false>
    32:        0x11038a9cc - rustc_query_impl[5e7782f17777a7c9]::query_impl::analysis::get_query_non_incr::__rust_end_short_backtrace
    33:        0x10ee8f0b4 - <rustc_interface[1340bb505392beac]::queries::QueryResult<&rustc_middle[5a798f9924bfd2e0]::ty::context::GlobalCtxt>>::enter::<core[f827f14b5e761a5d]::result::Result<(), rustc_span[ab16d476329f5d04]::ErrorGuaranteed>, rustc_driver_impl[54c40c94c6cfc0b2]::run_compiler::{closure#0}::{closure#1}::{closure#5}>
    34:        0x10eea61a0 - <rustc_interface[1340bb505392beac]::interface::Compiler>::enter::<rustc_driver_impl[54c40c94c6cfc0b2]::run_compiler::{closure#0}::{closure#1}, core[f827f14b5e761a5d]::result::Result<core[f827f14b5e761a5d]::option::Option<rustc_interface[1340bb505392beac]::queries::Linker>, rustc_span[ab16d476329f5d04]::ErrorGuaranteed>>
    35:        0x10ee9a98c - <scoped_tls[df49f867320abf2e]::ScopedKey<rustc_span[ab16d476329f5d04]::SessionGlobals>>::set::<rustc_interface[1340bb505392beac]::util::run_in_thread_with_globals<rustc_interface[1340bb505392beac]::interface::run_compiler<core[f827f14b5e761a5d]::result::Result<(), rustc_span[ab16d476329f5d04]::ErrorGuaranteed>, rustc_driver_impl[54c40c94c6cfc0b2]::run_compiler::{closure#0}>::{closure#1}, core[f827f14b5e761a5d]::result::Result<(), rustc_span[ab16d476329f5d04]::ErrorGuaranteed>>::{closure#0}::{closure#0}::{closure#0}, core[f827f14b5e761a5d]::result::Result<(), rustc_span[ab16d476329f5d04]::ErrorGuaranteed>>
    36:        0x10eea5b34 - rustc_span[ab16d476329f5d04]::create_session_globals_then::<core[f827f14b5e761a5d]::result::Result<(), rustc_span[ab16d476329f5d04]::ErrorGuaranteed>, rustc_interface[1340bb505392beac]::util::run_in_thread_with_globals<rustc_interface[1340bb505392beac]::interface::run_compiler<core[f827f14b5e761a5d]::result::Result<(), rustc_span[ab16d476329f5d04]::ErrorGuaranteed>, rustc_driver_impl[54c40c94c6cfc0b2]::run_compiler::{closure#0}>::{closure#1}, core[f827f14b5e761a5d]::result::Result<(), rustc_span[ab16d476329f5d04]::ErrorGuaranteed>>::{closure#0}::{closure#0}::{closure#0}>
    37:        0x10eec38fc - std[4f7d7c3ef984657a]::sys::backtrace::__rust_begin_short_backtrace::<rustc_interface[1340bb505392beac]::util::run_in_thread_with_globals<rustc_interface[1340bb505392beac]::interface::run_compiler<core[f827f14b5e761a5d]::result::Result<(), rustc_span[ab16d476329f5d04]::ErrorGuaranteed>, rustc_driver_impl[54c40c94c6cfc0b2]::run_compiler::{closure#0}>::{closure#1}, core[f827f14b5e761a5d]::result::Result<(), rustc_span[ab16d476329f5d04]::ErrorGuaranteed>>::{closure#0}::{closure#0}, core[f827f14b5e761a5d]::result::Result<(), rustc_span[ab16d476329f5d04]::ErrorGuaranteed>>
    38:        0x10eea37dc - <<std[4f7d7c3ef984657a]::thread::Builder>::spawn_unchecked_<rustc_interface[1340bb505392beac]::util::run_in_thread_with_globals<rustc_interface[1340bb505392beac]::interface::run_compiler<core[f827f14b5e761a5d]::result::Result<(), rustc_span[ab16d476329f5d04]::ErrorGuaranteed>, rustc_driver_impl[54c40c94c6cfc0b2]::run_compiler::{closure#0}>::{closure#1}, core[f827f14b5e761a5d]::result::Result<(), rustc_span[ab16d476329f5d04]::ErrorGuaranteed>>::{closure#0}::{closure#0}, core[f827f14b5e761a5d]::result::Result<(), rustc_span[ab16d476329f5d04]::ErrorGuaranteed>>::{closure#1} as core[f827f14b5e761a5d]::ops::function::FnOnce<()>>::call_once::{shim:vtable#0}
    39:        0x1052b6fa4 - std::sys::pal::unix::thread::Thread::new::thread_start::h1bd1b9c95010bf71
    40:        0x18c1672e4 - __pthread_deallocate
```

</p>
</details>