@@ -134,7 +134,8 @@ enum GenericArgPosition {
134
134
135
135
/// A marker denoting that the generic arguments that were
136
136
/// 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 > ) ;
138
139
139
140
impl < ' o , ' tcx > dyn AstConv < ' tcx > + ' o {
140
141
pub fn ast_region_to_region (
@@ -320,18 +321,19 @@ impl<'o, 'tcx> dyn AstConv<'tcx> + 'o {
320
321
let mut explicit_lifetimes = Ok ( ( ) ) ;
321
322
if !infer_lifetimes {
322
323
if let Some ( span_late) = def. has_late_bound_regions {
323
- explicit_lifetimes = Err ( GenericArgCountMismatch ) ;
324
324
let msg = "cannot specify lifetime arguments explicitly \
325
325
if late bound lifetime parameters are present";
326
326
let note = "the late bound lifetime parameter is introduced here" ;
327
327
let span = args. args [ 0 ] . span ( ) ;
328
328
if position == GenericArgPosition :: Value
329
329
&& arg_counts. lifetimes != param_counts. lifetimes
330
330
{
331
+ explicit_lifetimes = Err ( GenericArgCountMismatch ( Some ( ErrorReported ) ) ) ;
331
332
let mut err = tcx. sess . struct_span_err ( span, msg) ;
332
333
err. span_note ( span_late, note) ;
333
334
err. emit ( ) ;
334
335
} else {
336
+ explicit_lifetimes = Err ( GenericArgCountMismatch ( None ) ) ;
335
337
let mut multispan = MultiSpan :: from_span ( span) ;
336
338
multispan. push_span_label ( span_late, note. to_string ( ) ) ;
337
339
tcx. struct_span_lint_hir (
@@ -405,7 +407,7 @@ impl<'o, 'tcx> dyn AstConv<'tcx> + 'o {
405
407
}
406
408
err. emit ( ) ;
407
409
408
- Err ( GenericArgCountMismatch )
410
+ Err ( GenericArgCountMismatch ( Some ( ErrorReported ) ) )
409
411
} ;
410
412
411
413
let mut arg_count_correct = explicit_lifetimes;
0 commit comments