Change:
let param_env = tcx.param_env(block.owner.to_def_id()); let cause = ObligationCause::misc(span, block.owner.def_id); let mut fulfillment_errors = Vec::new(); <del> let mut applicable_candidates: Vec<_> = candidates .iter() .filter_map(|&(impl_, (assoc_item, def_scope))| { infcx.probe(|_| { let ocx = ObligationCtxt::new_in_snapshot(&infcx); </del> <ins> let mut applicable_candidates: Vec<_> = infcx.probe(|_| { let universe = infcx.create_next_universe(); // Regions are not considered during selection. let self_ty = tcx.replace_escaping_bound_vars_uncached( self_ty, FnMutDelegate { regions: &mut |_| tcx.lifetimes.re_erased, types: &mut |bv| { tcx.mk_placeholder(ty::PlaceholderType { universe, name: bv.kind }) }, consts: &mut |bv, ty| { tcx.mk_const(ty::PlaceholderConst { universe, name: bv }, ty) }, }, ); </ins> <del> let impl_ty = tcx.type_of(impl_); let impl_substs = infcx.fresh_item_substs(impl_); let impl_ty = impl_ty.subst(tcx, impl_substs); let impl_ty = ocx.normalize(&cause, param_env, impl_ty); </del> <ins> candidates .iter() .filter_map(|&(impl_, (assoc_item, def_scope))| { infcx.probe(|_| { let ocx = ObligationCtxt::new_in_snapshot(&infcx); </ins> <del> // Check that the Self-types can be related. // FIXME(fmease): Should we use `eq` here? ocx.sup(&ObligationCause::dummy(), param_env, impl_ty, self_ty).ok()?; </del> <ins> let impl_ty = tcx.type_of(impl_); let impl_substs = infcx.fresh_item_substs(impl_); let impl_ty = impl_ty.subst(tcx, impl_substs); let impl_ty = ocx.normalize(&cause, param_env, impl_ty); </ins> <del> // Check whether the impl imposes obligations we have to worry about. let impl_bounds = tcx.predicates_of(impl_); let impl_bounds = impl_bounds.instantiate(tcx, impl_substs); </del> <ins> // Check that the Self-types can be related. // FIXME(fmease): Should we use `eq` here? ocx.sup(&ObligationCause::dummy(), param_env, impl_ty, self_ty).ok()?; </ins> <del> let impl_bounds = ocx.normalize(&cause, param_env, impl_bounds); </del> <ins> // Check whether the impl imposes obligations we have to worry about. let impl_bounds = tcx.predicates_of(impl_); let impl_bounds = impl_bounds.instantiate(tcx, impl_substs); </ins> <del> let impl_obligations = traits::predicates_for_generics( |_, _| cause.clone(), param_env, impl_bounds, ); </del> <ins> let impl_bounds = ocx.normalize(&cause, param_env, impl_bounds); </ins> <del> ocx.register_obligations(impl_obligations); </del> <ins> let impl_obligations = traits::predicates_for_generics( |_, _| cause.clone(), param_env, impl_bounds, ); </ins> <del> let mut errors = ocx.select_where_possible(); if !errors.is_empty() { fulfillment_errors.append(&mut errors); return None; } </del> <ins> ocx.register_obligations(impl_obligations); let mut errors = ocx.select_where_possible(); if !errors.is_empty() { fulfillment_errors.append(&mut errors); return None; } </ins> <del> // FIXME(fmease): Unsolved vars can escape this InferCtxt snapshot. Some((assoc_item, def_scope, infcx.resolve_vars_if_possible(impl_substs))) </del> <ins> // FIXME(fmease): Unsolved vars can escape this InferCtxt snapshot. Some((assoc_item, def_scope, infcx.resolve_vars_if_possible(impl_substs))) }) </ins> }) <del> }) .collect(); </del> <ins> .collect() }); </ins> if applicable_candidates.len() > 1 { return Err(self.complain_about_ambiguous_inherent_assoc_type(

Discussion:
<!-- 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. --<!-- 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<!-- TRIAGEBOTSTART --<!-- TRIAGEBOTASSIGNSTART --<!-- TRIAGEBOTASSIGNDATASTARTTRIAGEBOTASSIGNDATAEND --<!-- TRIAGEBOTASSIGNEND --<!-- TRIAGEBOTEND --
searched nightlies: from nightly-2023-02-17 to nightly-2023-03-18 regressed nightly: nightly-2023-02-21 searched commit range: regressed commit: <details<summarybisected with <a href=''cargo-bisect-rustc</av0.6.5</summaryHost triple: x86_64-unknown-linux-gnu Reproduce with: </details
cc is this fixed by your branch?
No, it's not. The stacktrace does indeed contain but that's not the root cause of the problem. It just calls which ices (changing it to doesn't help either). The actual (?) bug is probably inside of the code I assume.
Ah, wait. If it's a bug to pass s to the type relating functions then it is the fault of and it should probably return early if a type . Edit: But it that case?
Hm, actually I think we should just fix the relate code instead.
Sure. I also feel like I've seen this ICE message pop up several times already on this issue tracker. I might be mistaken tho.
More minimal:
Reassigning to myself since the approach involving region erasure during selection we talked about fixes this issue (obviously) and since I'd like to integrate this into my PR to be able to write UI tests that exercise the bound region code used during IAT confirmation (otherwise we would never go past selection in those cases). claim label F-inherentassociatedtypes