@@ -197,7 +197,7 @@ enum SelectionCandidate<'tcx> {
197197 /// Implementation of a `Fn`-family trait by one of the anonymous types
198198 /// generated for a `||` expression. The ty::ClosureKind informs the
199199 /// confirmation step what ClosureKind obligation to emit.
200- ClosureCandidate ( /* closure */ DefId , & ' tcx ty:: ClosureSubsts < ' tcx > , ty:: ClosureKind ) ,
200+ ClosureCandidate ( /* closure */ DefId , ty:: ClosureSubsts < ' tcx > , ty:: ClosureKind ) ,
201201
202202 /// Implementation of a `Fn`-family trait by one of the anonymous
203203 /// types generated for a fn pointer type (e.g., `fn(int)->int`)
@@ -1270,7 +1270,7 @@ impl<'cx, 'gcx, 'tcx> SelectionContext<'cx, 'gcx, 'tcx> {
12701270 // type/region parameters
12711271 let self_ty = * obligation. self_ty ( ) . skip_binder ( ) ;
12721272 let ( closure_def_id, substs) = match self_ty. sty {
1273- ty:: TyClosure ( id, ref substs) => ( id, substs) ,
1273+ ty:: TyClosure ( id, substs) => ( id, substs) ,
12741274 ty:: TyInfer ( ty:: TyVar ( _) ) => {
12751275 debug ! ( "assemble_unboxed_closure_candidates: ambiguous self-type" ) ;
12761276 candidates. ambiguous = true ;
@@ -1707,16 +1707,16 @@ impl<'cx, 'gcx, 'tcx> SelectionContext<'cx, 'gcx, 'tcx> {
17071707
17081708 ty:: TyStr | ty:: TySlice ( _) | ty:: TyTrait ( ..) => Never ,
17091709
1710- ty:: TyTuple ( ref tys) => {
1710+ ty:: TyTuple ( tys) => {
17111711 // FIXME(#33242) we only need to constrain the last field
1712- Where ( ty:: Binder ( tys. clone ( ) ) )
1712+ Where ( ty:: Binder ( tys. to_vec ( ) ) )
17131713 }
17141714
17151715 ty:: TyStruct ( def, substs) | ty:: TyEnum ( def, substs) => {
17161716 let sized_crit = def. sized_constraint ( self . tcx ( ) ) ;
17171717 // (*) binder moved here
17181718 Where ( ty:: Binder ( match sized_crit. sty {
1719- ty:: TyTuple ( ref tys) => tys. to_owned ( ) . subst ( self . tcx ( ) , substs) ,
1719+ ty:: TyTuple ( tys) => tys. to_vec ( ) . subst ( self . tcx ( ) , substs) ,
17201720 ty:: TyBool => vec ! [ ] ,
17211721 _ => vec ! [ sized_crit. subst( self . tcx( ) , substs) ]
17221722 } ) )
@@ -1763,9 +1763,9 @@ impl<'cx, 'gcx, 'tcx> SelectionContext<'cx, 'gcx, 'tcx> {
17631763 Where ( ty:: Binder ( vec ! [ element_ty] ) )
17641764 }
17651765
1766- ty:: TyTuple ( ref tys) => {
1766+ ty:: TyTuple ( tys) => {
17671767 // (*) binder moved here
1768- Where ( ty:: Binder ( tys. clone ( ) ) )
1768+ Where ( ty:: Binder ( tys. to_vec ( ) ) )
17691769 }
17701770
17711771 ty:: TyStruct ( ..) | ty:: TyEnum ( ..) | ty:: TyProjection ( ..) | ty:: TyParam ( ..) => {
@@ -1842,7 +1842,7 @@ impl<'cx, 'gcx, 'tcx> SelectionContext<'cx, 'gcx, 'tcx> {
18421842
18431843 ty:: TyTuple ( ref tys) => {
18441844 // (T1, ..., Tn) -- meets any bound that all of T1...Tn meet
1845- tys. clone ( )
1845+ tys. to_vec ( )
18461846 }
18471847
18481848 ty:: TyClosure ( _, ref substs) => {
@@ -1854,7 +1854,7 @@ impl<'cx, 'gcx, 'tcx> SelectionContext<'cx, 'gcx, 'tcx> {
18541854 // OIBIT interact? That is, there is no way to say
18551855 // "make me invariant with respect to this TYPE, but
18561856 // do not act as though I can reach it"
1857- substs. upvar_tys . clone ( )
1857+ substs. upvar_tys . to_vec ( )
18581858 }
18591859
18601860 // for `PhantomData<T>`, we pass `T`
@@ -2188,7 +2188,7 @@ impl<'cx, 'gcx, 'tcx> SelectionContext<'cx, 'gcx, 'tcx> {
21882188
21892189 fn vtable_impl ( & mut self ,
21902190 impl_def_id : DefId ,
2191- mut substs : Normalized < ' tcx , Substs < ' tcx > > ,
2191+ mut substs : Normalized < ' tcx , & ' tcx Substs < ' tcx > > ,
21922192 cause : ObligationCause < ' tcx > ,
21932193 recursion_depth : usize ,
21942194 skol_map : infer:: SkolemizationMap ,
@@ -2221,7 +2221,7 @@ impl<'cx, 'gcx, 'tcx> SelectionContext<'cx, 'gcx, 'tcx> {
22212221 impl_obligations. append ( & mut substs. obligations ) ;
22222222
22232223 VtableImplData { impl_def_id : impl_def_id,
2224- substs : self . tcx ( ) . mk_substs ( substs. value ) ,
2224+ substs : substs. value ,
22252225 nested : impl_obligations }
22262226 }
22272227
@@ -2311,7 +2311,7 @@ impl<'cx, 'gcx, 'tcx> SelectionContext<'cx, 'gcx, 'tcx> {
23112311 fn confirm_closure_candidate ( & mut self ,
23122312 obligation : & TraitObligation < ' tcx > ,
23132313 closure_def_id : DefId ,
2314- substs : & ty:: ClosureSubsts < ' tcx > ,
2314+ substs : ty:: ClosureSubsts < ' tcx > ,
23152315 kind : ty:: ClosureKind )
23162316 -> Result < VtableClosureData < ' tcx , PredicateObligation < ' tcx > > ,
23172317 SelectionError < ' tcx > >
@@ -2586,7 +2586,7 @@ impl<'cx, 'gcx, 'tcx> SelectionContext<'cx, 'gcx, 'tcx> {
25862586 impl_def_id : DefId ,
25872587 obligation : & TraitObligation < ' tcx > ,
25882588 snapshot : & infer:: CombinedSnapshot )
2589- -> ( Normalized < ' tcx , Substs < ' tcx > > , infer:: SkolemizationMap )
2589+ -> ( Normalized < ' tcx , & ' tcx Substs < ' tcx > > , infer:: SkolemizationMap )
25902590 {
25912591 match self . match_impl ( impl_def_id, obligation, snapshot) {
25922592 Ok ( ( substs, skol_map) ) => ( substs, skol_map) ,
@@ -2602,7 +2602,7 @@ impl<'cx, 'gcx, 'tcx> SelectionContext<'cx, 'gcx, 'tcx> {
26022602 impl_def_id : DefId ,
26032603 obligation : & TraitObligation < ' tcx > ,
26042604 snapshot : & infer:: CombinedSnapshot )
2605- -> Result < ( Normalized < ' tcx , Substs < ' tcx > > ,
2605+ -> Result < ( Normalized < ' tcx , & ' tcx Substs < ' tcx > > ,
26062606 infer:: SkolemizationMap ) , ( ) >
26072607 {
26082608 let impl_trait_ref = self . tcx ( ) . impl_trait_ref ( impl_def_id) . unwrap ( ) ;
@@ -2752,7 +2752,7 @@ impl<'cx, 'gcx, 'tcx> SelectionContext<'cx, 'gcx, 'tcx> {
27522752 fn closure_trait_ref_unnormalized ( & mut self ,
27532753 obligation : & TraitObligation < ' tcx > ,
27542754 closure_def_id : DefId ,
2755- substs : & ty:: ClosureSubsts < ' tcx > )
2755+ substs : ty:: ClosureSubsts < ' tcx > )
27562756 -> ty:: PolyTraitRef < ' tcx >
27572757 {
27582758 let closure_type = self . infcx . closure_type ( closure_def_id, substs) ;
@@ -2773,7 +2773,7 @@ impl<'cx, 'gcx, 'tcx> SelectionContext<'cx, 'gcx, 'tcx> {
27732773 fn closure_trait_ref ( & mut self ,
27742774 obligation : & TraitObligation < ' tcx > ,
27752775 closure_def_id : DefId ,
2776- substs : & ty:: ClosureSubsts < ' tcx > )
2776+ substs : ty:: ClosureSubsts < ' tcx > )
27772777 -> Normalized < ' tcx , ty:: PolyTraitRef < ' tcx > >
27782778 {
27792779 let trait_ref = self . closure_trait_ref_unnormalized (
0 commit comments