Change:
I'm seeing an internal compiler error on the following input (found by ): The error happens on stable, beta, and nightly.
This regressed in .
cc
triage: already has fix in pipeline. P-high. removing nomination label.

Discussion:
Codegen { query codegen_fulfill_obligation( key: (ty::ParamEnv<'tcx>, ty::PolyTraitRef<'tcx>) <del> ) -> Vtable<'tcx, ()> { </del> <ins> ) -> Option<Vtable<'tcx, ()>> { </ins> no_force cache_on_disk_if { true } desc { |tcx|

pub fn codegen_fulfill_obligation<'tcx>( ty: TyCtxt<'tcx>, (param_env, trait_ref): (ty::ParamEnv<'tcx>, ty::PolyTraitRef<'tcx>), <del> ) -> Vtable<'tcx, ()> { </del> <ins> ) -> Option<Vtable<'tcx, ()>> { </ins> // Remove any references to regions; this helps improve caching. let trait_ref = ty.erase_regions(&trait_ref);

// leading to an ambiguous result. So report this as an // overflow bug, since I believe this is the only case // where ambiguity can result. <del> bug!( "Encountered ambiguity selecting `{:?}` during codegen,  presuming due to overflow", trait_ref ) </del> <ins> infcx.tcx.sess.delay_span_bug( rustc_span::DUMMY_SP, &format!( "encountered ambiguity selecting `{:?}` during codegen, presuming due to  overflow or prior type error", trait_ref ), ); return None; </ins> } Err(e) => { bug!("Encountered error `{:?}` selecting `{:?}` during codegen", e, trait_ref)

let vtable = infcx.drain_fulfillment_cx_or_panic(&mut fulfill_cx, &vtable); info!("Cache miss: {:?} => {:?}", trait_ref, vtable); <del> vtable </del> <ins> Some(vtable) </ins> }) }

}); match tcx.codegen_fulfill_obligation((ty::ParamEnv::reveal_all(), trait_ref)) { <del> traits::VtableImpl(traits::VtableImplData { impl_def_id, .. }) => { </del> <ins> Some(traits::VtableImpl(traits::VtableImplData { impl_def_id, .. })) => { </ins> tcx.coerce_unsized_info(impl_def_id).custom_kind.unwrap() } vtable => {

); let trait_ref = ty::TraitRef::from_method(tcx, trait_id, rcvr_substs); <del> let vtbl = tcx.codegen_fulfill_obligation((param_env, ty::Binder::bind(trait_ref))); </del> <ins> let vtbl = tcx.codegen_fulfill_obligation((param_env, ty::Binder::bind(trait_ref)))?; </ins> // Now that we know which impl is being used, we can dispatch to // the actual function:

<ins> trait TraitA { const VALUE: usize; } struct A; impl TraitA for A { const VALUE: usize = 0; } trait TraitB { type MyA: TraitA; const VALUE: usize = Self::MyA::VALUE; } struct B; impl TraitB for B { //~ ERROR not all trait items implemented, missing: `MyA` type M   = A; //~ ERROR type `M` is not a member of trait `TraitB` } fn main() { let _ = [0; B::VALUE]; } </ins>

<ins> error[E0437]: type `M` is not a member of trait `TraitB` --> $DIR/issue-69602-type-err-during-codegen-ice.rs:17:5 | LL |     type M   = A; |     ^^^^^^^^^^^^^ not a member of trait `TraitB` error[E0046]: not all trait items implemented, missing: `MyA` --> $DIR/issue-69602-type-err-during-codegen-ice.rs:16:1 | LL |     type MyA: TraitA; |     ----------------- `MyA` from trait ... LL | impl TraitB for B { | ^^^^^^^^^^^^^^^^^ missing `MyA` in implementation error: aborting due to 2 previous errors Some errors have detailed explanations: E0046, E0437. For more information about an error, try `rustc --explain E0046`. </ins>