Change:
<!-- 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. --code from <!-- 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. --: <!-- Include a backtrace in the code block by setting in your environment. E.g. . --<details<summary<strongBacktrace</strong</summary<p</p</details
The ICE appeared between and ; ran bisection: Regression in cc
If this is the worst we get - a regression in an unstable feature - I'll be happy. Not sure it will be. That said, the "fix" is simple: revert the revert. But the perf impact needs to be addressed.
this still crashes :thinking: `
oh... I only did a , need to all the way to codegen to hit this.

Discussion:
/// obligations *could be* resolved if we wanted to. /// /// This also expects that `trait_ref` is fully normalized. <ins> #[instrument(level = "debug", skip(tcx))] </ins> pub fn codegen_fulfill_obligation<'tcx>( tcx: TyCtxt<'tcx>, (param_env, trait_ref): (ty::ParamEnv<'tcx>, ty::PolyTraitRef<'tcx>),

let trait_ref = tcx.erase_regions(trait_ref); // We expect the input to be fully normalized. debug_assert_eq!(trait_ref, tcx.normalize_erasing_regions(param_env, trait_ref)); <del> debug!( "codegen_fulfill_obligation(trait_ref={:?}, def_id={:?})", (param_env, trait_ref), trait_ref.def_id() ); </del> // Do the initial selection for the obligation. This yields the // shallow result we are looking for -- that is, what specific impl.

} }; <del> debug!("fulfill_obligation: selection={:?}", selection); </del> <ins> debug!(?selection); </ins> // Currently, we use a fulfillment context to completely resolve // all nested obligations. This is because they can inform the // inference of the impl's type parameters. let mut fulfill_cx = FulfillmentContext::new(); let impl_source = selection.map(|predicate| { <del> debug!("fulfill_obligation: register_predicate_obligation {:?}", predicate); </del> fulfill_cx.register_predicate_obligation(&infcx, predicate); }); let impl_source = drain_fulfillment_cx_or_panic(&infcx, &mut fulfill_cx, impl_source); <del> // There should be no opaque types during codegen, they all get revealed. let opaque_types = infcx.inner.borrow_mut().opaque_type_storage.take_opaque_types(); if !opaque_types.is_empty() { bug!("{:#?}", opaque_types); } </del> <ins> // Opaque types may have gotten their hidden types constrained, but we can ignore them safely // as they will get constrained elsewhere, too. let _opaque_types = infcx.inner.borrow_mut().opaque_type_storage.take_opaque_types(); </ins> <del> debug!("Cache miss: {:?} => {:?}", trait_ref, impl_source); </del> <ins> debug!("Cache miss: {trait_ref:?} => {impl_source:?}"); </ins> Ok(&*tcx.arena.alloc(impl_source)) }) }

<ins> #![feature(type_alias_impl_trait)] // build-pass trait T { type Item; } type Alias<'a> = impl T<Item = &'a ()>; struct S; impl<'a> T for &'a S { type Item = &'a (); } fn filter_positive<'a>() -> Alias<'a> { &S } fn with_positive(fun: impl Fn(Alias<'_>)) { fun(filter_positive()); } fn main() { with_positive(|_| ()); } </ins>