File tree Expand file tree Collapse file tree 2 files changed +8
-11
lines changed Expand file tree Collapse file tree 2 files changed +8
-11
lines changed Original file line number Diff line number Diff line change @@ -14,7 +14,6 @@ use syntax::ext::build::AstBuilder;
14
14
use syntax:: symbol:: Symbol ;
15
15
use syntax_pos;
16
16
use syntax:: tokenstream;
17
- use syntax:: print:: pprust;
18
17
19
18
use std:: string:: String ;
20
19
@@ -55,15 +54,7 @@ pub fn expand_syntax_ext(cx: &mut base::ExtCtxt,
55
54
}
56
55
_ => {
57
56
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" ,
64
- format ! ( "\" {{}}\" , {}" , msg)
65
- ) ;
66
- err. span_note (
57
+ err. span_help (
67
58
e. span ,
68
59
"you might be missing a string literal to format with" ,
69
60
) ;
Original file line number Diff line number Diff line change @@ -2,7 +2,13 @@ error: expected a literal
2
2
--> $DIR/bad_hello.rs:12:14
3
3
|
4
4
LL | println!(3 + 4); //~ ERROR expected a literal
5
- | ^^^^^ help: consider changing this to: `"{}", 3 + 4`
5
+ | ^^^^^
6
+ |
7
+ help: you might be missing a string literal to format with
8
+ --> $DIR/bad_hello.rs:12:14
9
+ |
10
+ LL | println!(3 + 4); //~ ERROR expected a literal
11
+ | ^^^^^
6
12
7
13
error: aborting due to previous error
8
14
You can’t perform that action at this time.
0 commit comments