about summary refs log tree commit diff
path: root/compiler/rustc_hir_analysis/src/variance/constraints.rs
diff options
context:
space:
mode:
authorMichael Goulet <michael@errs.io>2023-09-26 02:15:32 +0000
committerMichael Goulet <michael@errs.io>2023-09-26 02:53:59 +0000
commitd6ce9ce115e8d0859e378b411966905c8b815845 (patch)
tree35362a68ca4449d6c47afa05df2e33cd91a46970 /compiler/rustc_hir_analysis/src/variance/constraints.rs
parentc614c17626a2dd02e88586a04bd0971d9ec2cae5 (diff)
downloadrust-d6ce9ce115e8d0859e378b411966905c8b815845.tar.gz
rust-d6ce9ce115e8d0859e378b411966905c8b815845.zip
Don't store lazyness in DefKind
Diffstat (limited to 'compiler/rustc_hir_analysis/src/variance/constraints.rs')
-rw-r--r--compiler/rustc_hir_analysis/src/variance/constraints.rs10
1 files changed, 4 insertions, 6 deletions
diff --git a/compiler/rustc_hir_analysis/src/variance/constraints.rs b/compiler/rustc_hir_analysis/src/variance/constraints.rs
index 9aac7160f2e..61d9c989e2f 100644
--- a/compiler/rustc_hir_analysis/src/variance/constraints.rs
+++ b/compiler/rustc_hir_analysis/src/variance/constraints.rs
@@ -6,7 +6,7 @@
 use hir::def_id::{DefId, LocalDefId};
 use rustc_hir as hir;
 use rustc_hir::def::DefKind;
-use rustc_middle::ty::{self, Ty, TyCtxt, TypeVisitableExt};
+use rustc_middle::ty::{self, Ty, TyCtxt};
 use rustc_middle::ty::{GenericArgKind, GenericArgsRef};
 
 use super::terms::VarianceTerm::*;
@@ -78,9 +78,7 @@ pub fn add_constraints_from_crate<'a, 'tcx>(
                 }
             }
             DefKind::Fn | DefKind::AssocFn => constraint_cx.build_constraints_for_item(def_id),
-            DefKind::TyAlias { lazy }
-                if lazy || tcx.type_of(def_id).instantiate_identity().has_opaque_types() =>
-            {
+            DefKind::TyAlias if tcx.type_alias_is_lazy(def_id) => {
                 constraint_cx.build_constraints_for_item(def_id)
             }
             _ => {}
@@ -110,8 +108,8 @@ impl<'a, 'tcx> ConstraintContext<'a, 'tcx> {
 
         // The type as returned by `type_of` is the underlying type and generally not a weak projection.
         // Therefore we need to check the `DefKind` first.
-        if let DefKind::TyAlias { lazy } = tcx.def_kind(def_id)
-            && (lazy || ty.has_opaque_types())
+        if let DefKind::TyAlias = tcx.def_kind(def_id)
+            && tcx.type_alias_is_lazy(def_id)
         {
             self.add_constraints_from_ty(current_item, ty, self.covariant);
             return;