@@ -46,18 +46,21 @@ pub struct ConfirmResult<'tcx> {
46
46
}
47
47
48
48
impl < ' 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
+ ) ;
61
64
62
65
let mut confirm_cx = ConfirmContext :: new ( self , span, self_expr, call_expr) ;
63
66
confirm_cx. confirm ( unadjusted_self_ty, pick, segment)
@@ -78,11 +81,12 @@ impl<'a, 'gcx, 'tcx> ConfirmContext<'a, 'gcx, 'tcx> {
78
81
}
79
82
}
80
83
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 > {
86
90
// Adjust the self expression the user provided and obtain the adjusted type.
87
91
let self_ty = self . adjust_self_ty ( unadjusted_self_ty, & pick) ;
88
92
@@ -300,17 +304,19 @@ impl<'a, 'gcx, 'tcx> ConfirmContext<'a, 'gcx, 'tcx> {
300
304
} )
301
305
}
302
306
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 > {
308
313
// Determine the values for the generic parameters of the method.
309
314
// If they were not explicitly supplied, just construct fresh
310
315
// variables.
311
316
let method_generics = self . tcx . generics_of ( pick. item . def_id ) ;
312
317
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) ;
314
320
315
321
// Create subst for early-bound lifetime parameters, combining
316
322
// parameters from the type and those from the method.
0 commit comments