diff options
Diffstat (limited to 'src/librustc_const_eval')
| -rw-r--r-- | src/librustc_const_eval/eval.rs | 11 |
1 files changed, 7 insertions, 4 deletions
diff --git a/src/librustc_const_eval/eval.rs b/src/librustc_const_eval/eval.rs index d424b57c938..43d9725baaf 100644 --- a/src/librustc_const_eval/eval.rs +++ b/src/librustc_const_eval/eval.rs @@ -1337,10 +1337,13 @@ pub fn eval_length<'a, 'tcx>(tcx: TyCtxt<'a, 'tcx, 'tcx>, Ok(val as usize) }, Ok(const_val) => { - span_err!(tcx.sess, count_expr.span, E0306, - "expected usize for {}, found {}", - reason, - const_val.description()); + struct_span_err!(tcx.sess, count_expr.span, E0306, + "expected `usize` for {}, found {}", + reason, + const_val.description()) + .span_label(count_expr.span, &format!("expected `usize`")) + .emit(); + Err(ErrorReported) } Err(err) => { |
