Combine identical alias arms

This commit is contained in:
Michael Goulet 2022-11-27 17:52:17 +00:00
parent 61adaf8187
commit 96cb18e864
29 changed files with 69 additions and 120 deletions

View file

@ -453,10 +453,9 @@ impl<'cx, 'tcx> TypeFolder<'tcx> for Canonicalizer<'cx, 'tcx> {
| ty::Dynamic(..)
| ty::Never
| ty::Tuple(..)
| ty::Alias(ty::Projection, ..)
| ty::Alias(..)
| ty::Foreign(..)
| ty::Param(..)
| ty::Alias(ty::Opaque, ..) => {
| ty::Param(..) => {
if t.flags().intersects(self.needs_canonical_flags) {
t.super_fold_with(self)
} else {

View file

@ -589,8 +589,8 @@ impl<'tcx> InferCtxt<'tcx> {
hidden_ty
}
// FIXME(RPITIT): This can go away when we move to associated types
ty::Alias(ty::Projection, proj)
if def_id.to_def_id() == proj.def_id && substs == proj.substs =>
ty::Alias(ty::Projection, ty::AliasTy { def_id: def_id2, substs: substs2 })
if def_id.to_def_id() == def_id2 && substs == substs2 =>
{
hidden_ty
}