1
Fork 0

Simplify some redundant names

This commit is contained in:
Michael Goulet 2023-12-13 15:01:33 +00:00
parent 3799568895
commit 427c55c65c
6 changed files with 19 additions and 23 deletions

View file

@ -2348,11 +2348,11 @@ impl<'tcx> TypeErrCtxt<'_, 'tcx> {
GenericKind::Param(ref p) => format!("the parameter type `{p}`"),
GenericKind::Placeholder(ref p) => format!("the placeholder type `{p:?}`"),
GenericKind::Alias(ref p) => match p.kind(self.tcx) {
ty::AliasKind::Projection | ty::AliasKind::Inherent => {
ty::Projection | ty::Inherent => {
format!("the associated type `{p}`")
}
ty::AliasKind::Weak => format!("the type alias `{p}`"),
ty::AliasKind::Opaque => format!("the opaque type `{p}`"),
ty::Weak => format!("the type alias `{p}`"),
ty::Opaque => format!("the opaque type `{p}`"),
},
};

View file

@ -511,7 +511,7 @@ impl<'infcx, 'tcx> CombineFields<'infcx, 'tcx> {
));
} else {
match a_ty.kind() {
&ty::Alias(ty::AliasKind::Projection, data) => {
&ty::Alias(ty::Projection, data) => {
// FIXME: This does not handle subtyping correctly, we could
// instead create a new inference variable for `a_ty`, emitting
// `Projection(a_ty, a_infer)` and `a_infer <: b_ty`.
@ -523,10 +523,9 @@ impl<'infcx, 'tcx> CombineFields<'infcx, 'tcx> {
))
}
// The old solver only accepts projection predicates for associated types.
ty::Alias(
ty::AliasKind::Inherent | ty::AliasKind::Weak | ty::AliasKind::Opaque,
_,
) => return Err(TypeError::CyclicTy(a_ty)),
ty::Alias(ty::Inherent | ty::Weak | ty::Opaque, _) => {
return Err(TypeError::CyclicTy(a_ty));
}
_ => bug!("generalizated `{a_ty:?} to infer, not an alias"),
}
}