We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
1 parent b79a83b commit c999b25Copy full SHA for c999b25
src/libsyntax_ext/concat.rs
@@ -55,10 +55,17 @@ pub fn expand_syntax_ext(cx: &mut base::ExtCtxt,
55
}
56
_ => {
57
let mut err = cx.struct_span_err(e.span, "expected a literal");
58
+ let msg = cx.codemap().span_to_snippet(e.span).unwrap_or_else(
59
+ |_| pprust::expr_to_string(&e)
60
+ );
61
err.span_suggestion(
62
e.span,
63
"consider changing this to",
- format!("\"{{}}\", {}", pprust::expr_to_string(&e))
64
+ format!("\"{{}}\", {}", msg)
65
66
+ err.span_note(
67
+ e.span,
68
+ "you might be missing a string literal to format with",
69
);
70
err.emit();
71
0 commit comments