Skip to content

Error message for E0307 is weird #26485 #26778

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
Jul 29, 2015
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
16 changes: 8 additions & 8 deletions src/librustc/middle/ty.rs
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,7 @@ use metadata::csearch;
use middle;
use middle::cast;
use middle::check_const;
use middle::const_eval::{self, ConstVal};
use middle::const_eval::{self, ConstVal, ErrKind};
use middle::const_eval::EvalHint::UncheckedExprHint;
use middle::def::{self, DefMap, ExportMap};
use middle::dependency_format;
Expand Down Expand Up @@ -6107,20 +6107,20 @@ impl<'tcx> ctxt<'tcx> {
found);
}
Err(err) => {
let err_description = err.description();
let found = match count_expr.node {
let err_msg = match count_expr.node {
ast::ExprPath(None, ast::Path {
global: false,
ref segments,
..
}) if segments.len() == 1 =>
format!("{}", "found variable"),
_ =>
format!("but {}", err_description),
format!("found variable"),
_ => match err.kind {
ErrKind::MiscCatchAll => format!("but found {}", err.description()),
_ => format!("but {}", err.description())
}
};
span_err!(self.sess, count_expr.span, E0307,
"expected constant integer for repeat count, {}",
found);
"expected constant integer for repeat count, {}", err_msg);
}
}
0
Expand Down