Skip to content

rustc: Fix formatting of env! error message #11463

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 2 commits into from
Jan 11, 2014
Merged
Show file tree
Hide file tree
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
2 changes: 1 addition & 1 deletion src/libsyntax/ext/env.rs
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,7 @@ pub fn expand_env(cx: &mut ExtCtxt, sp: Span, tts: &[ast::TokenTree])

let (var, _var_str_style) = expr_to_str(cx, exprs[0], "expected string literal");
let msg = match exprs.len() {
1 => format!("Environment variable {} not defined", var).to_managed(),
1 => format!("environment variable `{}` not defined", var).to_managed(),
2 => {
let (s, _style) = expr_to_str(cx, exprs[1], "expected string literal");
s
Expand Down
10 changes: 5 additions & 5 deletions src/libsyntax/ext/tt/macro_parser.rs
Original file line number Diff line number Diff line change
Expand Up @@ -351,9 +351,9 @@ pub fn parse(sess: @ParseSess,
}
return Success(nameize(sess, ms, v));
} else if eof_eis.len() > 1u {
return Error(sp, ~"Ambiguity: multiple successful parses");
return Error(sp, ~"ambiguity: multiple successful parses");
} else {
return Failure(sp, ~"Unexpected end of macro invocation");
return Failure(sp, ~"unexpected end of macro invocation");
}
} else {
if (bb_eis.len() > 0u && next_eis.len() > 0u)
Expand All @@ -367,12 +367,12 @@ pub fn parse(sess: @ParseSess,
_ => fail!()
} }).connect(" or ");
return Error(sp, format!(
"Local ambiguity: multiple parsing options: \
"local ambiguity: multiple parsing options: \
built-in NTs {} or {} other options.",
nts, next_eis.len()));
} else if (bb_eis.len() == 0u && next_eis.len() == 0u) {
return Failure(sp, ~"No rules expected the token: "
+ to_str(get_ident_interner(), &tok));
return Failure(sp, format!("no rules expected the token `{}`",
to_str(get_ident_interner(), &tok)));
} else if (next_eis.len() > 0u) {
/* Now process the next token */
while(next_eis.len() > 0u) {
Expand Down
2 changes: 1 addition & 1 deletion src/test/compile-fail/extenv-not-defined-default.rs
Original file line number Diff line number Diff line change
Expand Up @@ -8,4 +8,4 @@
// option. This file may not be copied, modified, or distributed
// except according to those terms.

fn main() { env!("__HOPEFULLY_NOT_DEFINED__"); } //~ ERROR: Environment variable __HOPEFULLY_NOT_DEFINED__ not defined
fn main() { env!("__HOPEFULLY_NOT_DEFINED__"); } //~ ERROR: environment variable `__HOPEFULLY_NOT_DEFINED__` not defined