@@ -46,18 +46,21 @@ pub struct ConfirmResult<'tcx> {
4646}
4747
4848impl < ' a , ' gcx , ' tcx > FnCtxt < ' a , ' gcx , ' tcx > {
49- pub fn confirm_method ( & self ,
50- span : Span ,
51- self_expr : & ' gcx hir:: Expr ,
52- call_expr : & ' gcx hir:: Expr ,
53- unadjusted_self_ty : Ty < ' tcx > ,
54- pick : probe:: Pick < ' tcx > ,
55- segment : & hir:: PathSegment )
56- -> ConfirmResult < ' tcx > {
57- debug ! ( "confirm(unadjusted_self_ty={:?}, pick={:?}, generic_args={:?})" ,
58- unadjusted_self_ty,
59- pick,
60- segment. parameters) ;
49+ pub fn confirm_method (
50+ & self ,
51+ span : Span ,
52+ self_expr : & ' gcx hir:: Expr ,
53+ call_expr : & ' gcx hir:: Expr ,
54+ unadjusted_self_ty : Ty < ' tcx > ,
55+ pick : probe:: Pick < ' tcx > ,
56+ segment : & hir:: PathSegment ,
57+ ) -> ConfirmResult < ' tcx > {
58+ debug ! (
59+ "confirm(unadjusted_self_ty={:?}, pick={:?}, generic_args={:?})" ,
60+ unadjusted_self_ty,
61+ pick,
62+ segment. parameters,
63+ ) ;
6164
6265 let mut confirm_cx = ConfirmContext :: new ( self , span, self_expr, call_expr) ;
6366 confirm_cx. confirm ( unadjusted_self_ty, pick, segment)
@@ -78,11 +81,12 @@ impl<'a, 'gcx, 'tcx> ConfirmContext<'a, 'gcx, 'tcx> {
7881 }
7982 }
8083
81- fn confirm ( & mut self ,
82- unadjusted_self_ty : Ty < ' tcx > ,
83- pick : probe:: Pick < ' tcx > ,
84- segment : & hir:: PathSegment )
85- -> ConfirmResult < ' tcx > {
84+ fn confirm (
85+ & mut self ,
86+ unadjusted_self_ty : Ty < ' tcx > ,
87+ pick : probe:: Pick < ' tcx > ,
88+ segment : & hir:: PathSegment ,
89+ ) -> ConfirmResult < ' tcx > {
8690 // Adjust the self expression the user provided and obtain the adjusted type.
8791 let self_ty = self . adjust_self_ty ( unadjusted_self_ty, & pick) ;
8892
@@ -300,17 +304,19 @@ impl<'a, 'gcx, 'tcx> ConfirmContext<'a, 'gcx, 'tcx> {
300304 } )
301305 }
302306
303- fn instantiate_method_substs ( & mut self ,
304- pick : & probe:: Pick < ' tcx > ,
305- segment : & hir:: PathSegment ,
306- parent_substs : & Substs < ' tcx > )
307- -> & ' tcx Substs < ' tcx > {
307+ fn instantiate_method_substs (
308+ & mut self ,
309+ pick : & probe:: Pick < ' tcx > ,
310+ segment : & hir:: PathSegment ,
311+ parent_substs : & Substs < ' tcx > ,
312+ ) -> & ' tcx Substs < ' tcx > {
308313 // Determine the values for the generic parameters of the method.
309314 // If they were not explicitly supplied, just construct fresh
310315 // variables.
311316 let method_generics = self . tcx . generics_of ( pick. item . def_id ) ;
312317 let mut fn_segment = Some ( ( segment, method_generics) ) ;
313- self . fcx . check_path_parameter_count ( self . span , & mut fn_segment, true , false ) ;
318+ let supress_mismatch = self . fcx . check_impl_trait ( self . span , fn_segment) ;
319+ self . fcx . check_path_parameter_count ( self . span , & mut fn_segment, true , supress_mismatch) ;
314320
315321 // Create subst for early-bound lifetime parameters, combining
316322 // parameters from the type and those from the method.
0 commit comments