@@ -250,7 +250,7 @@ impl<'a, 'tcx> Builder<'a, 'tcx> {
250
250
let ref_str_ty = tcx. mk_imm_ref ( re_erased, tcx. types . str_ ) ;
251
251
let ref_str = self . temp ( ref_str_ty, test. span ) ;
252
252
let deref = tcx. require_lang_item ( LangItem :: Deref , None ) ;
253
- let method = trait_method ( tcx, deref, sym:: deref, ty, & [ ] ) ;
253
+ let method = trait_method ( tcx, deref, sym:: deref, ty, [ ] ) ;
254
254
let eq_block = self . cfg . start_new_block ( ) ;
255
255
self . cfg . push_assign ( block, source_info, ref_string, Rvalue :: Ref ( re_erased, BorrowKind :: Shared , place) ) ;
256
256
self . cfg . terminate (
@@ -444,8 +444,8 @@ impl<'a, 'tcx> Builder<'a, 'tcx> {
444
444
bug ! ( "non_scalar_compare called on non-reference type: {}" , ty) ;
445
445
} ;
446
446
447
- let eq_def_id = self . tcx . require_lang_item ( LangItem :: PartialEq , None ) ;
448
- let method = trait_method ( self . tcx , eq_def_id, sym:: eq, deref_ty, & [ deref_ty. into ( ) ] ) ;
447
+ let eq_def_id = self . tcx . require_lang_item ( LangItem :: PartialEq , Some ( source_info . span ) ) ;
448
+ let method = trait_method ( self . tcx , eq_def_id, sym:: eq, deref_ty, [ deref_ty. into ( ) ] ) ;
449
449
450
450
let bool_ty = self . tcx . types . bool ;
451
451
let eq_result = self . temp ( bool_ty, source_info. span ) ;
@@ -838,9 +838,9 @@ fn trait_method<'tcx>(
838
838
trait_def_id : DefId ,
839
839
method_name : Symbol ,
840
840
self_ty : Ty < ' tcx > ,
841
- params : & [ GenericArg < ' tcx > ] ,
841
+ params : impl IntoIterator < Item = GenericArg < ' tcx > , IntoIter : ExactSizeIterator > ,
842
842
) -> ConstantKind < ' tcx > {
843
- let substs = tcx. mk_substs_trait ( self_ty, params. iter ( ) . copied ( ) ) ;
843
+ let substs = tcx. mk_substs_trait ( self_ty, params) ;
844
844
845
845
// The unhygienic comparison here is acceptable because this is only
846
846
// used on known traits.
@@ -850,8 +850,7 @@ fn trait_method<'tcx>(
850
850
. find ( |item| item. kind == ty:: AssocKind :: Fn )
851
851
. expect ( "trait method not found" ) ;
852
852
853
- let method_ty = tcx. bound_type_of ( item. def_id ) ;
854
- let method_ty = method_ty. subst ( tcx, substs) ;
853
+ let method_ty = tcx. mk_fn_def ( item. def_id , substs) ;
855
854
856
855
ConstantKind :: zero_sized ( method_ty)
857
856
}
0 commit comments