Skip to content

Commit a067b45

Browse files
Blake LoringBlake Loring
Blake Loring
authored and
Blake Loring
committed
Modified to add 'found' to error message closes #26485
1 parent d576ef3 commit a067b45

File tree

1 file changed

+8
-8
lines changed

1 file changed

+8
-8
lines changed

src/librustc/middle/ty.rs

+8-8
Original file line numberDiff line numberDiff line change
@@ -44,7 +44,7 @@ use metadata::csearch;
4444
use middle;
4545
use middle::cast;
4646
use middle::check_const;
47-
use middle::const_eval::{self, ConstVal};
47+
use middle::const_eval::{self, ConstVal, ErrKind};
4848
use middle::const_eval::EvalHint::UncheckedExprHint;
4949
use middle::def::{self, DefMap, ExportMap};
5050
use middle::dependency_format;
@@ -6107,20 +6107,20 @@ impl<'tcx> ctxt<'tcx> {
61076107
found);
61086108
}
61096109
Err(err) => {
6110-
let err_description = err.description();
6111-
let found = match count_expr.node {
6110+
let err_msg = match count_expr.node {
61126111
ast::ExprPath(None, ast::Path {
61136112
global: false,
61146113
ref segments,
61156114
..
61166115
}) if segments.len() == 1 =>
6117-
format!("{}", "found variable"),
6118-
_ =>
6119-
format!("but {}", err_description),
6116+
format!("found variable"),
6117+
_ => match err.kind {
6118+
ErrKind::MiscCatchAll => format!("but found {}", err.description()),
6119+
_ => format!("but {}", err.description())
6120+
}
61206121
};
61216122
span_err!(self.sess, count_expr.span, E0307,
6122-
"expected constant integer for repeat count, {}",
6123-
found);
6123+
"expected constant integer for repeat count, {}", err_msg);
61246124
}
61256125
}
61266126
0

0 commit comments

Comments
 (0)