Skip to content

Commit f8a4a65

Browse files
camelidBoxyUwU
andcommitted
Reuse existing logic for type aliases
Co-authored-by: BoxyUwU <[email protected]>
1 parent 61c5e74 commit f8a4a65

File tree

1 file changed

+3
-14
lines changed
  • compiler/rustc_hir_analysis/src/hir_ty_lowering

1 file changed

+3
-14
lines changed

compiler/rustc_hir_analysis/src/hir_ty_lowering/mod.rs

+3-14
Original file line numberDiff line numberDiff line change
@@ -1167,20 +1167,9 @@ impl<'tcx> dyn HirTyLowerer<'tcx> + '_ {
11671167
LowerAssocMode::Type { permit_variants },
11681168
)? {
11691169
LoweredAssoc::Term(def_id, args) => {
1170-
let assoc = tcx.associated_item(def_id);
1171-
let ty = if matches!(
1172-
assoc,
1173-
ty::AssocItem {
1174-
container: ty::AssocItemContainer::Impl,
1175-
trait_item_def_id: None,
1176-
..
1177-
}
1178-
) {
1179-
Ty::new_alias(tcx, ty::Inherent, ty::AliasTy::new_from_args(tcx, def_id, args))
1180-
} else {
1181-
Ty::new_projection_from_args(tcx, def_id, args)
1182-
};
1183-
Ok((ty, DefKind::AssocTy, def_id))
1170+
let alias_ty = ty::AliasTy::new_from_args(tcx, def_id, args);
1171+
let ty = Ty::new_alias(tcx, alias_ty.kind(tcx), alias_ty);
1172+
Ok((ty, tcx.def_kind(def_id), def_id))
11841173
}
11851174
LoweredAssoc::Variant { adt, variant_did } => Ok((adt, DefKind::Variant, variant_did)),
11861175
}

0 commit comments

Comments
 (0)