@@ -134,7 +134,8 @@ enum GenericArgPosition {
134134
135135/// A marker denoting that the generic arguments that were
136136/// provided did not match the respective generic parameters.
137- pub struct GenericArgCountMismatch ;
137+ /// The field indicates whether a fatal error was reported (`Some`), or just a lint (`None`).
138+ pub struct GenericArgCountMismatch ( pub Option < ErrorReported > ) ;
138139
139140impl < ' o , ' tcx > dyn AstConv < ' tcx > + ' o {
140141 pub fn ast_region_to_region (
@@ -320,18 +321,19 @@ impl<'o, 'tcx> dyn AstConv<'tcx> + 'o {
320321 let mut explicit_lifetimes = Ok ( ( ) ) ;
321322 if !infer_lifetimes {
322323 if let Some ( span_late) = def. has_late_bound_regions {
323- explicit_lifetimes = Err ( GenericArgCountMismatch ) ;
324324 let msg = "cannot specify lifetime arguments explicitly \
325325 if late bound lifetime parameters are present";
326326 let note = "the late bound lifetime parameter is introduced here" ;
327327 let span = args. args [ 0 ] . span ( ) ;
328328 if position == GenericArgPosition :: Value
329329 && arg_counts. lifetimes != param_counts. lifetimes
330330 {
331+ explicit_lifetimes = Err ( GenericArgCountMismatch ( Some ( ErrorReported ) ) ) ;
331332 let mut err = tcx. sess . struct_span_err ( span, msg) ;
332333 err. span_note ( span_late, note) ;
333334 err. emit ( ) ;
334335 } else {
336+ explicit_lifetimes = Err ( GenericArgCountMismatch ( None ) ) ;
335337 let mut multispan = MultiSpan :: from_span ( span) ;
336338 multispan. push_span_label ( span_late, note. to_string ( ) ) ;
337339 tcx. struct_span_lint_hir (
@@ -405,7 +407,7 @@ impl<'o, 'tcx> dyn AstConv<'tcx> + 'o {
405407 }
406408 err. emit ( ) ;
407409
408- Err ( GenericArgCountMismatch )
410+ Err ( GenericArgCountMismatch ( Some ( ErrorReported ) ) )
409411 } ;
410412
411413 let mut arg_count_correct = explicit_lifetimes;
0 commit comments