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. --<!-- 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 --
This might also be related to cc
label F-inherentassociatedtypes claim

Discussion:
| ty::Param(_) | ty::Placeholder(..) | ty::Infer(ty::IntVar(_) | ty::FloatVar(_)) <ins> | ty::Alias(ty::Inherent, _) </ins> | ty::Error(_) => return, ty::Infer(ty::TyVar(_) | ty::FreshTy(_) | ty::FreshIntTy(_) | ty::FreshFloatTy(_)) | ty::Bound(..) => bug!("unexpected self type for `{goal:?}`"), <del> ty::Alias(_, alias_ty) => alias_ty, </del> <ins> // Excluding IATs here as they don't have meaningful item bounds. ty::Alias(ty::Projection | ty::Opaque, alias_ty) => alias_ty, </ins> }; for assumption in self.tcx().item_bounds(alias_ty.def_id).subst(self.tcx(), alias_ty.substs)

// Check whether the self-type is itself a projection. // If so, extract what we know from the trait and try to come up with a good answer. let bounds = match *obligation.predicate.self_ty().kind() { <del> ty::Alias(_, ref data) => tcx.item_bounds(data.def_id).subst(tcx, data.substs), </del> <ins> // Excluding IATs here as they don't have meaningful item bounds. ty::Alias(ty::Projection | ty::Opaque, ref data) => { tcx.item_bounds(data.def_id).subst(tcx, data.substs) } </ins> ty::Infer(ty::TyVar(_)) => { // If the self-type is an inference variable, then it MAY wind up // being a projected type, so induce an ambiguity.

// Before we go into the whole placeholder thing, just // quickly check if the self-type is a projection at all. match obligation.predicate.skip_binder().trait_ref.self_ty().kind() { <del> ty::Alias(..) => {} </del> <ins> // Excluding IATs here as they don't have meaningful item bounds. ty::Alias(ty::Projection | ty::Opaque, _) => {} </ins> ty::Infer(ty::TyVar(_)) => { span_bug!( obligation.cause.span,

let placeholder_self_ty = placeholder_trait_predicate.self_ty(); let placeholder_trait_predicate = ty::Binder::dummy(placeholder_trait_predicate); let (def_id, substs) = match *placeholder_self_ty.kind() { <del> ty::Alias(_, ty::AliasTy { def_id, substs, .. }) => (def_id, substs), </del> <ins> // Excluding IATs here as they don't have meaningful item bounds. ty::Alias(ty::Projection | ty::Opaque, ty::AliasTy { def_id, substs, .. }) => { (def_id, substs) } </ins> _ => bug!("projection candidate for unexpected type: {:?}", placeholder_self_ty), };

let tcx = self.infcx.tcx; let (def_id, substs) = match *placeholder_trait_predicate.trait_ref.self_ty().kind() { <del> ty::Alias(_, ty::AliasTy { def_id, substs, .. }) => (def_id, substs), </del> <ins> ty::Alias(ty::Projection | ty::Opaque, ty::AliasTy { def_id, substs, .. }) => { (def_id, substs) } </ins> _ => { span_bug!( obligation.cause.span,

<ins> #![feature(inherent_associated_types)] #![allow(incomplete_features)] // Check that rustc doesn't crash on the trait bound `Self::Ty: std::marker::Freeze`. pub struct Struct; impl Struct { pub type Ty = usize; pub const CT: Self::Ty = 42; } fn main() {} </ins>