@@ -34,7 +34,6 @@ use trans::machine;
3434use trans:: type_:: Type ;
3535use trans:: type_of:: * ;
3636use middle:: ty:: { self , Ty , TyCtxt , TypeFoldable } ;
37- use middle:: ty:: MethodCall ;
3837
3938use syntax:: ast:: { self , Name } ;
4039use syntax:: attr;
@@ -110,7 +109,7 @@ pub fn callee_for_trait_impl<'a, 'tcx>(ccx: &CrateContext<'a, 'tcx>,
110109 // those from the impl and those from the method:
111110 let impl_substs = vtable_impl. substs . with_method_from ( & substs) ;
112111 let substs = ccx. tcx ( ) . mk_substs ( impl_substs) ;
113- let mth = get_impl_method ( ccx. tcx ( ) , impl_did, impl_substs , mname) ;
112+ let mth = get_impl_method ( ccx. tcx ( ) , impl_did, substs , mname) ;
114113
115114 // Translate the function, bypassing Callee::def.
116115 // That is because default methods have the same ID as the
@@ -318,7 +317,7 @@ pub fn get_vtable<'a, 'tcx>(ccx: &CrateContext<'a, 'tcx>,
318317 trans_fn_ref_with_substs ( ccx,
319318 mth. method . def_id ,
320319 None ,
321- mth. substs ) . val
320+ & mth. substs ) . val
322321 }
323322 None => nullptr
324323 }
@@ -431,7 +430,7 @@ pub fn get_vtable_methods<'a, 'tcx>(ccx: &CrateContext<'a, 'tcx>,
431430
432431 // The substitutions we have are on the impl, so we grab
433432 // the method type from the impl to substitute into.
434- let mth = get_impl_method ( tcx, impl_id, substs. clone ( ) , name) ;
433+ let mth = get_impl_method ( tcx, impl_id, substs, name) ;
435434
436435 debug ! ( "get_vtable_methods: mth={:?}" , mth) ;
437436
@@ -441,7 +440,7 @@ pub fn get_vtable_methods<'a, 'tcx>(ccx: &CrateContext<'a, 'tcx>,
441440 // method could then never be called, so we do not want to
442441 // try and trans it, in that case. Issue #23435.
443442 if mth. is_provided {
444- let predicates = mth. method . predicates . predicates . subst ( tcx, mth. substs ) ;
443+ let predicates = mth. method . predicates . predicates . subst ( tcx, & mth. substs ) ;
445444 if !normalize_and_test_predicates ( ccx, predicates. into_vec ( ) ) {
446445 debug ! ( "get_vtable_methods: predicates do not hold" ) ;
447446 return None ;
@@ -473,14 +472,14 @@ fn opaque_method_ty<'tcx>(tcx: &TyCtxt<'tcx>, method_ty: &ty::BareFnTy<'tcx>)
473472#[ derive( Debug ) ]
474473pub struct ImplMethod < ' tcx > {
475474 pub method : Rc < ty:: Method < ' tcx > > ,
476- pub substs : Substs < ' tcx > ,
475+ pub substs : & ' tcx Substs < ' tcx > ,
477476 pub is_provided : bool
478477}
479478
480479/// Locates the applicable definition of a method, given its name.
481480pub fn get_impl_method < ' tcx > ( tcx : & TyCtxt < ' tcx > ,
482481 impl_def_id : DefId ,
483- substs : Substs < ' tcx > ,
482+ substs : & ' tcx Substs < ' tcx > ,
484483 name : Name )
485484 -> ImplMethod < ' tcx >
486485{
0 commit comments