diff options
| author | Felix S. Klock II <pnkfelix@pnkfx.org> | 2015-03-28 18:47:08 +0100 |
|---|---|---|
| committer | Felix S. Klock II <pnkfelix@pnkfx.org> | 2015-04-01 02:56:07 +0200 |
| commit | 7875dae83fac23fdf59765eb548c2237850d6b15 (patch) | |
| tree | dae69e299f032da78f4198bc7b75f618a740288f | |
| parent | 2f7658a52829b8208330401735c1b88638ed44c0 (diff) | |
| download | rust-7875dae83fac23fdf59765eb548c2237850d6b15.tar.gz rust-7875dae83fac23fdf59765eb548c2237850d6b15.zip | |
ty.rs improve error feedback when const-eval errs during repeat count eval.
| -rw-r--r-- | src/librustc/middle/ty.rs | 9 |
1 files changed, 5 insertions, 4 deletions
diff --git a/src/librustc/middle/ty.rs b/src/librustc/middle/ty.rs index 2bfc9689ac2..87d17cbc04f 100644 --- a/src/librustc/middle/ty.rs +++ b/src/librustc/middle/ty.rs @@ -6047,19 +6047,20 @@ pub fn eval_repeat_count(tcx: &ctxt, count_expr: &ast::Expr) -> usize { "expected positive integer for repeat count, found {}", found); } - Err(_) => { + Err(err) => { + let err_description = err.description(); let found = match count_expr.node { ast::ExprPath(None, ast::Path { global: false, ref segments, .. }) if segments.len() == 1 => - "variable", + format!("{}", "found variable"), _ => - "non-constant expression" + format!("but {}", err_description), }; span_err!(tcx.sess, count_expr.span, E0307, - "expected constant integer for repeat count, found {}", + "expected constant integer for repeat count, {}", found); } } |
