about summary refs log tree commit diff
path: root/compiler/rustc_ty_utils/src/needs_drop.rs
diff options
context:
space:
mode:
authorKyle Matsuda <kyle.yoshio.matsuda@gmail.com>2023-02-06 17:48:12 -0700
committerKyle Matsuda <kyle.yoshio.matsuda@gmail.com>2023-02-16 17:01:52 -0700
commitd822b97a27e50f5a091d2918f6ff0ffd2d2827f5 (patch)
treedd0aae1c09476ba8d74e83999cadc77266ae2c20 /compiler/rustc_ty_utils/src/needs_drop.rs
parent9a7cc6c32f1a690f86827e4724bcda85e506ef35 (diff)
downloadrust-d822b97a27e50f5a091d2918f6ff0ffd2d2827f5.tar.gz
rust-d822b97a27e50f5a091d2918f6ff0ffd2d2827f5.zip
change usages of type_of to bound_type_of
Diffstat (limited to 'compiler/rustc_ty_utils/src/needs_drop.rs')
-rw-r--r--compiler/rustc_ty_utils/src/needs_drop.rs14
1 files changed, 10 insertions, 4 deletions
diff --git a/compiler/rustc_ty_utils/src/needs_drop.rs b/compiler/rustc_ty_utils/src/needs_drop.rs
index cd1475391a4..01d8fb1c4cf 100644
--- a/compiler/rustc_ty_utils/src/needs_drop.rs
+++ b/compiler/rustc_ty_utils/src/needs_drop.rs
@@ -295,9 +295,15 @@ fn adt_drop_tys<'tcx>(
     let adt_has_dtor =
         |adt_def: ty::AdtDef<'tcx>| adt_def.destructor(tcx).map(|_| DtorType::Significant);
     // `tcx.type_of(def_id)` identical to `tcx.make_adt(def, identity_substs)`
-    drop_tys_helper(tcx, tcx.type_of(def_id), tcx.param_env(def_id), adt_has_dtor, false)
-        .collect::<Result<Vec<_>, _>>()
-        .map(|components| tcx.intern_type_list(&components))
+    drop_tys_helper(
+        tcx,
+        tcx.bound_type_of(def_id).subst_identity(),
+        tcx.param_env(def_id),
+        adt_has_dtor,
+        false,
+    )
+    .collect::<Result<Vec<_>, _>>()
+    .map(|components| tcx.intern_type_list(&components))
 }
 // If `def_id` refers to a generic ADT, the queries above and below act as if they had been handed
 // a `tcx.make_ty(def, identity_substs)` and as such it is legal to substitute the generic parameters
@@ -308,7 +314,7 @@ fn adt_significant_drop_tys(
 ) -> Result<&ty::List<Ty<'_>>, AlwaysRequiresDrop> {
     drop_tys_helper(
         tcx,
-        tcx.type_of(def_id), // identical to `tcx.make_adt(def, identity_substs)`
+        tcx.bound_type_of(def_id).subst_identity(), // identical to `tcx.make_adt(def, identity_substs)`
         tcx.param_env(def_id),
         adt_consider_insignificant_dtor(tcx),
         true,