File tree 3 files changed +7
-11
lines changed 3 files changed +7
-11
lines changed Original file line number Diff line number Diff line change @@ -842,14 +842,10 @@ fn walk_parents<'tcx>(
842
842
} else if let Some ( trait_id) = cx. tcx . trait_of_item ( id)
843
843
&& let arg_ty = cx. tcx . erase_regions ( cx. typeck_results ( ) . expr_ty_adjusted ( e) )
844
844
&& let ty:: Ref ( _, sub_ty, _) = * arg_ty. kind ( )
845
- && let subs = match cx
845
+ && let subs = cx
846
846
. typeck_results ( )
847
- . node_substs_opt ( parent. hir_id )
848
- . and_then ( |subs| subs. get ( 1 ..) )
849
- {
850
- Some ( subs) => cx. tcx . mk_substs ( subs. iter ( ) . copied ( ) ) ,
851
- None => cx. tcx . mk_substs ( std:: iter:: empty :: < ty:: subst:: GenericArg < ' _ > > ( ) ) ,
852
- } && let impl_ty = if cx. tcx . fn_sig ( id) . skip_binder ( ) . inputs ( ) [ 0 ] . is_ref ( ) {
847
+ . node_substs_opt ( parent. hir_id ) . map ( |subs| & subs[ 1 ..] ) . unwrap_or_default ( )
848
+ && let impl_ty = if cx. tcx . fn_sig ( id) . skip_binder ( ) . inputs ( ) [ 0 ] . is_ref ( ) {
853
849
// Trait methods taking `&self`
854
850
sub_ty
855
851
} else {
@@ -858,7 +854,7 @@ fn walk_parents<'tcx>(
858
854
} && impl_ty. is_ref ( )
859
855
&& let infcx = cx. tcx . infer_ctxt ( ) . build ( )
860
856
&& infcx
861
- . type_implements_trait ( trait_id, impl_ty, subs, cx. param_env )
857
+ . type_implements_trait ( trait_id, [ impl_ty. into ( ) ] . into_iter ( ) . chain ( subs. iter ( ) . copied ( ) ) , cx. param_env )
862
858
. must_apply_modulo_regions ( )
863
859
{
864
860
return Some ( Position :: MethodReceiverRefImpl )
Original file line number Diff line number Diff line change @@ -692,7 +692,7 @@ fn matches_preds<'tcx>(
692
692
let infcx = cx. tcx . infer_ctxt ( ) . build ( ) ;
693
693
preds. iter ( ) . all ( |& p| match cx. tcx . erase_late_bound_regions ( p) {
694
694
ExistentialPredicate :: Trait ( p) => infcx
695
- . type_implements_trait ( p. def_id , ty , p. substs , cx. param_env )
695
+ . type_implements_trait ( p. def_id , [ ty . into ( ) ] . into_iter ( ) . chain ( p. substs . iter ( ) ) , cx. param_env )
696
696
. must_apply_modulo_regions ( ) ,
697
697
ExistentialPredicate :: Projection ( p) => infcx. predicate_must_hold_modulo_regions ( & Obligation :: new (
698
698
cx. tcx ,
@@ -704,7 +704,7 @@ fn matches_preds<'tcx>(
704
704
) ) ,
705
705
) ) ,
706
706
ExistentialPredicate :: AutoTrait ( p) => infcx
707
- . type_implements_trait ( p, ty , List :: empty ( ) , cx. param_env )
707
+ . type_implements_trait ( p, [ ty ] , cx. param_env )
708
708
. must_apply_modulo_regions ( ) ,
709
709
} )
710
710
}
Original file line number Diff line number Diff line change @@ -178,7 +178,7 @@ pub fn implements_trait_with_env<'tcx>(
178
178
} ;
179
179
let ty_params = tcx. mk_substs ( ty_params. into_iter ( ) . map ( |arg| arg. unwrap_or_else ( || infcx. next_ty_var ( orig) . into ( ) ) ) ) ;
180
180
infcx
181
- . type_implements_trait ( trait_id, ty , ty_params, param_env)
181
+ . type_implements_trait ( trait_id, [ ty . into ( ) ] . into_iter ( ) . chain ( ty_params) , param_env)
182
182
. must_apply_modulo_regions ( )
183
183
}
184
184
You can’t perform that action at this time.
0 commit comments