diff --git a/src/libsyntax_ext/concat.rs b/src/libsyntax_ext/concat.rs index 1f79c1db995..2325bcbd657 100644 --- a/src/libsyntax_ext/concat.rs +++ b/src/libsyntax_ext/concat.rs @@ -14,7 +14,6 @@ use syntax::ext::build::AstBuilder; use syntax::symbol::Symbol; use syntax_pos; use syntax::tokenstream; -use syntax::print::pprust; use std::string::String; @@ -55,15 +54,7 @@ pub fn expand_syntax_ext(cx: &mut base::ExtCtxt, } _ => { let mut err = cx.struct_span_err(e.span, "expected a literal"); - let msg = cx.codemap().span_to_snippet(e.span).unwrap_or_else( - |_| pprust::expr_to_string(&e) - ); - err.span_suggestion( - e.span, - "consider changing this to", - format!("\"{{}}\", {}", msg) - ); - err.span_note( + err.span_help( e.span, "you might be missing a string literal to format with", ); diff --git a/src/test/ui/macros/bad_hello.stderr b/src/test/ui/macros/bad_hello.stderr index 23486e3cd1c..34bc589b5c5 100644 --- a/src/test/ui/macros/bad_hello.stderr +++ b/src/test/ui/macros/bad_hello.stderr @@ -2,7 +2,13 @@ error: expected a literal --> $DIR/bad_hello.rs:12:14 | LL | println!(3 + 4); //~ ERROR expected a literal - | ^^^^^ help: consider changing this to: `"{}", 3 + 4` + | ^^^^^ + | +help: you might be missing a string literal to format with + --> $DIR/bad_hello.rs:12:14 + | +LL | println!(3 + 4); //~ ERROR expected a literal + | ^^^^^ error: aborting due to previous error