diff options
| author | varkor <github@varkor.com> | 2020-01-21 22:36:17 +0000 |
|---|---|---|
| committer | varkor <github@varkor.com> | 2020-02-22 00:27:45 +0000 |
| commit | 750e673491114cd8454f1715ce1fda8dd02b7ac0 (patch) | |
| tree | b670bcac552b48e970872c911419097ab3b39547 | |
| parent | 9939de24ac3580acfb92670f9bd568f90052340b (diff) | |
| download | rust-750e673491114cd8454f1715ce1fda8dd02b7ac0.tar.gz rust-750e673491114cd8454f1715ce1fda8dd02b7ac0.zip | |
Report late-bound region lint as error in `check_generic_arg_count`
| -rw-r--r-- | src/librustc_typeck/astconv.rs | 9 |
1 files changed, 4 insertions, 5 deletions
diff --git a/src/librustc_typeck/astconv.rs b/src/librustc_typeck/astconv.rs index a1440c3e289..1e5e00445cc 100644 --- a/src/librustc_typeck/astconv.rs +++ b/src/librustc_typeck/astconv.rs @@ -313,9 +313,10 @@ impl<'o, 'tcx> dyn AstConv<'tcx> + 'o { } // Prohibit explicit lifetime arguments if late-bound lifetime parameters are present. - let mut reported_late_bound_region_err = None; + let mut reported_late_bound_region_err = false; if !infer_lifetimes { if let Some(span_late) = def.has_late_bound_regions { + reported_late_bound_region_err = true; let msg = "cannot specify lifetime arguments explicitly \ if late bound lifetime parameters are present"; let note = "the late bound lifetime parameter is introduced here"; @@ -326,7 +327,6 @@ impl<'o, 'tcx> dyn AstConv<'tcx> + 'o { let mut err = tcx.sess.struct_span_err(span, msg); err.span_note(span_late, note); err.emit(); - reported_late_bound_region_err = Some(true); } else { let mut multispan = MultiSpan::from_span(span); multispan.push_span_label(span_late, note.to_string()); @@ -336,7 +336,6 @@ impl<'o, 'tcx> dyn AstConv<'tcx> + 'o { multispan, |lint| lint.build(msg).emit(), ); - reported_late_bound_region_err = Some(false); } } } @@ -405,10 +404,10 @@ impl<'o, 'tcx> dyn AstConv<'tcx> + 'o { true }; - let mut arg_count_mismatch = reported_late_bound_region_err.unwrap_or(false); + let mut arg_count_mismatch = reported_late_bound_region_err; let mut unexpected_spans = vec![]; - if reported_late_bound_region_err.is_none() + if !reported_late_bound_region_err && (!infer_lifetimes || arg_counts.lifetimes > param_counts.lifetimes) { arg_count_mismatch |= check_kind_count( |
