File tree 2 files changed +9
-7
lines changed
2 files changed +9
-7
lines changed Original file line number Diff line number Diff line change 13
13
// up in the expanded output) without the appropriate feature.
14
14
15
15
pub fn f0 ( ) {
16
- println ! ( panic!( "this should work" ) ) ;
16
+ panic ! ( "this should work" ) ;
17
17
}
18
18
19
19
pub fn main ( ) {
20
- println ! ( __unstable_rustc_ensure_not_fmt_string_literal!(
21
- "`main`" , "this should work, but its unstable" ) ) ;
20
+ __unstable_rustc_ensure_not_fmt_string_literal ! (
21
+ "`main`" , "this should work, but its unstable" ) ;
22
+ //~^^ ERROR use of unstable library feature 'ensure_not_fmt_string_literal'
23
+ //~| HELP add #![feature(ensure_not_fmt_string_literal)] to the crate attributes to enable
22
24
f0 ( ) ;
23
25
}
Original file line number Diff line number Diff line change 9
9
// except according to those terms.
10
10
11
11
#![ feature( rustc_attrs) ]
12
+ #![ feature( ensure_not_fmt_string_literal) ]
12
13
13
14
// Issue 22932: `panic!("{}");` should not compile.
14
15
@@ -52,19 +53,18 @@ pub fn f5() { panic!("nor this }}");
52
53
}
53
54
54
55
pub fn f0_a ( ) {
55
- ensure_not_fmt_string_literal ! ( "`f0_a`" , "this does not work {}" ) ;
56
+ __unstable_rustc_ensure_not_fmt_string_literal ! ( "`f0_a`" , "this does not work {}" ) ;
56
57
//~^ WARN `f0_a` literal argument contains `{`
57
58
//~| NOTE Is it meant to be a `format!` string?
58
59
//~| HELP You can wrap the argument in parentheses to sidestep this warning
59
60
}
60
61
61
62
pub fn f0_b ( ) {
62
- println ! ( ensure_not_fmt_string_literal! ( "`f0_b`" , "this does work" ) ) ;
63
+ __unstable_rustc_ensure_not_fmt_string_literal ! ( "`f0_b`" , "this does work" ) ;
63
64
}
64
65
65
66
pub fn f0_c ( ) {
66
- println ! ( "{}" ,
67
- ensure_not_fmt_string_literal!( "`f0_c`" , ( "so does this {}" ) ) ) ;
67
+ __unstable_rustc_ensure_not_fmt_string_literal ! ( "`f0_c`" , ( "so does this {}" ) ) ;
68
68
}
69
69
70
70
// This test is just checking that we get all the right warnings; none
You can’t perform that action at this time.
0 commit comments