Combine projection and opaque into alias

This commit is contained in:
Michael Goulet 2022-11-26 21:51:55 +00:00
parent c13bd83528
commit 61adaf8187
104 changed files with 387 additions and 381 deletions

View file

@ -849,7 +849,7 @@ impl<'tcx> Visitor<'tcx> for CostChecker<'_, 'tcx> {
};
let kind = match parent_ty.ty.kind() {
&ty::Opaque(ty::AliasTy { def_id, substs }) => {
&ty::Alias(ty::Opaque, ty::AliasTy { def_id, substs }) => {
self.tcx.bound_type_of(def_id).subst(self.tcx, substs).kind()
}
kind => kind,

View file

@ -52,7 +52,11 @@ impl<'tcx> MirPass<'tcx> for RemoveZsts {
fn maybe_zst(ty: Ty<'_>) -> bool {
match ty.kind() {
// maybe ZST (could be more precise)
ty::Adt(..) | ty::Array(..) | ty::Closure(..) | ty::Tuple(..) | ty::Opaque(..) => true,
ty::Adt(..)
| ty::Array(..)
| ty::Closure(..)
| ty::Tuple(..)
| ty::Alias(ty::Opaque, ..) => true,
// definitely ZST
ty::FnDef(..) | ty::Never => true,
// unreachable or can't be ZST