]> git.lizzy.rs Git - rust.git/blobdiff - src/librustc/traits/select.rs
Rollup merge of #65073 - ecstatic-morse:issue-65071, r=petrochenkov
[rust.git] / src / librustc / traits / select.rs
index 3450f3fc86592673fcc72c62e381cad2a51573f0..1fae2a2fe8dbffc783595f05aacbf58e5f2541a7 100644 (file)
@@ -40,7 +40,7 @@
 use crate::ty::{self, ToPolyTraitRef, ToPredicate, Ty, TyCtxt, TypeFoldable};
 
 use crate::hir;
-use rustc_data_structures::bit_set::GrowableBitSet;
+use rustc_index::bit_set::GrowableBitSet;
 use rustc_data_structures::sync::Lock;
 use rustc_target::spec::abi::Abi;
 use syntax::attr;
@@ -2051,8 +2051,10 @@ fn assemble_closure_candidates(
                     "assemble_unboxed_candidates: kind={:?} obligation={:?}",
                     kind, obligation
                 );
-                match self.infcx.closure_kind(closure_def_id,
-                    ty::ClosureSubsts::from_ref(closure_substs)) {
+                match self.infcx.closure_kind(
+                    closure_def_id,
+                    closure_substs
+                ) {
                     Some(closure_kind) => {
                         debug!(
                             "assemble_unboxed_candidates: closure_kind = {:?}",
@@ -2670,7 +2672,7 @@ fn copy_clone_conditions(
             ty::Closure(def_id, substs) => {
                 // (*) binder moved here
                 Where(ty::Binder::bind(
-                    substs.upvar_tys(def_id, self.tcx()).collect(),
+                    substs.as_closure().upvar_tys(def_id, self.tcx()).collect(),
                 ))
             }
 
@@ -2754,7 +2756,9 @@ fn constituent_types_for_ty(&self, t: Ty<'tcx>) -> Vec<Ty<'tcx>> {
                 tys.iter().map(|k| k.expect_ty()).collect()
             }
 
-            ty::Closure(def_id, ref substs) => substs.upvar_tys(def_id, self.tcx()).collect(),
+            ty::Closure(def_id, ref substs) => substs.as_closure()
+                .upvar_tys(def_id, self.tcx())
+                .collect(),
 
             ty::Generator(def_id, ref substs, _) => {
                 let witness = substs.witness(def_id, self.tcx());
@@ -3376,14 +3380,17 @@ fn confirm_closure_candidate(
             obligations.push(Obligation::new(
                 obligation.cause.clone(),
                 obligation.param_env,
-                ty::Predicate::ClosureKind(closure_def_id,
-                    ty::ClosureSubsts::from_ref(substs.clone()), kind),
+                ty::Predicate::ClosureKind(
+                    closure_def_id,
+                    substs,
+                    kind
+                ),
             ));
         }
 
         Ok(VtableClosureData {
             closure_def_id,
-            substs: ty::ClosureSubsts::from_ref(substs),
+            substs: substs,
             nested: obligations,
         })
     }
@@ -3878,8 +3885,7 @@ fn closure_trait_ref_unnormalized(
             "closure_trait_ref_unnormalized(obligation={:?}, closure_def_id={:?}, substs={:?})",
             obligation, closure_def_id, substs,
         );
-        let closure_type = self.infcx.closure_sig(closure_def_id,
-            ty::ClosureSubsts::from_ref(substs));
+        let closure_type = self.infcx.closure_sig(closure_def_id, substs);
 
         debug!(
             "closure_trait_ref_unnormalized: closure_type = {:?}",