File tree 3 files changed +56
-5
lines changed
3 files changed +56
-5
lines changed Original file line number Diff line number Diff line change @@ -396,18 +396,16 @@ macro_rules! write {
396
396
/// ```
397
397
#[ macro_export]
398
398
#[ stable( feature = "rust1" , since = "1.0.0" ) ]
399
+ #[ allow_internal_unstable]
399
400
macro_rules! writeln {
400
401
( $dst: expr) => (
401
402
write!( $dst, "\n " )
402
403
) ;
403
404
( $dst: expr, ) => (
404
405
writeln!( $dst)
405
406
) ;
406
- ( $dst: expr, $fmt: expr) => (
407
- write!( $dst, concat!( $fmt, "\n " ) )
408
- ) ;
409
- ( $dst: expr, $fmt: expr, $( $arg: tt) * ) => (
410
- write!( $dst, concat!( $fmt, "\n " ) , $( $arg) * )
407
+ ( $dst: expr, $( $arg: tt) * ) => (
408
+ $dst. write_fmt( format_args_nl!( $( $arg) * ) )
411
409
) ;
412
410
}
413
411
Original file line number Diff line number Diff line change
1
+ // Copyright 2018 The Rust Project Developers. See the COPYRIGHT
2
+ // file at the top-level directory of this distribution and at
3
+ // http://rust-lang.org/COPYRIGHT.
4
+ //
5
+ // Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or
6
+ // http://www.apache.org/licenses/LICENSE-2.0> or the MIT license
7
+ // <LICENSE-MIT or http://opensource.org/licenses/MIT>, at your
8
+ // option. This file may not be copied, modified, or distributed
9
+ // except according to those terms.
10
+
11
+ use std:: fmt:: Write ;
12
+
13
+ fn main ( ) {
14
+ println ! ( 0 ) ;
15
+ //~^ ERROR format argument must be a string literal
16
+ eprintln ! ( 'a' ) ;
17
+ //~^ ERROR format argument must be a string literal
18
+ let mut s = String :: new ( ) ;
19
+ writeln ! ( s, true ) . unwrap ( ) ;
20
+ //~^ ERROR format argument must be a string literal
21
+ }
Original file line number Diff line number Diff line change
1
+ error: format argument must be a string literal
2
+ --> $DIR/issue-30143.rs:14:14
3
+ |
4
+ LL | println!(0);
5
+ | ^
6
+ help: you might be missing a string literal to format with
7
+ |
8
+ LL | println!("{}", 0);
9
+ | ^^^^^
10
+
11
+ error: format argument must be a string literal
12
+ --> $DIR/issue-30143.rs:16:15
13
+ |
14
+ LL | eprintln!('a');
15
+ | ^^^
16
+ help: you might be missing a string literal to format with
17
+ |
18
+ LL | eprintln!("{}", 'a');
19
+ | ^^^^^
20
+
21
+ error: format argument must be a string literal
22
+ --> $DIR/issue-30143.rs:19:17
23
+ |
24
+ LL | writeln!(s, true).unwrap();
25
+ | ^^^^
26
+ help: you might be missing a string literal to format with
27
+ |
28
+ LL | writeln!(s, "{}", true).unwrap();
29
+ | ^^^^^
30
+
31
+ error: aborting due to 3 previous errors
32
+
You can’t perform that action at this time.
0 commit comments