diff options
| author | León Orell Valerian Liehr <me@fmease.dev> | 2023-08-06 23:02:27 +0200 |
|---|---|---|
| committer | León Orell Valerian Liehr <me@fmease.dev> | 2023-08-07 15:54:31 +0200 |
| commit | 5468336d6b11a56addc589cd24107915e3ba0d66 (patch) | |
| tree | 034a78a6db5d23484f62bff3869c313b56ed9f7c /compiler/rustc_hir_analysis/src/variance/constraints.rs | |
| parent | 34ccd0485966c3933288cd30a076bef63e3298c5 (diff) | |
| download | rust-5468336d6b11a56addc589cd24107915e3ba0d66.tar.gz rust-5468336d6b11a56addc589cd24107915e3ba0d66.zip | |
Store the laziness of type aliases in the DefKind
Diffstat (limited to 'compiler/rustc_hir_analysis/src/variance/constraints.rs')
| -rw-r--r-- | compiler/rustc_hir_analysis/src/variance/constraints.rs | 9 |
1 files changed, 4 insertions, 5 deletions
diff --git a/compiler/rustc_hir_analysis/src/variance/constraints.rs b/compiler/rustc_hir_analysis/src/variance/constraints.rs index 4a3d522e488..8a40509d7cc 100644 --- a/compiler/rustc_hir_analysis/src/variance/constraints.rs +++ b/compiler/rustc_hir_analysis/src/variance/constraints.rs @@ -78,9 +78,8 @@ pub fn add_constraints_from_crate<'a, 'tcx>( } } DefKind::Fn | DefKind::AssocFn => constraint_cx.build_constraints_for_item(def_id), - DefKind::TyAlias - if tcx.features().lazy_type_alias - || tcx.type_of(def_id).instantiate_identity().has_opaque_types() => + DefKind::TyAlias { lazy } + if lazy || tcx.type_of(def_id).instantiate_identity().has_opaque_types() => { constraint_cx.build_constraints_for_item(def_id) } @@ -111,8 +110,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 = tcx.def_kind(def_id) - && (tcx.features().lazy_type_alias || ty.has_opaque_types()) + if let DefKind::TyAlias { lazy } = tcx.def_kind(def_id) + && (lazy || ty.has_opaque_types()) { self.add_constraints_from_ty(current_item, ty, self.covariant); return; |
