diff options
| author | Esteban Küber <esteban@kuber.com.ar> | 2018-07-14 20:50:30 -0700 |
|---|---|---|
| committer | Esteban Küber <esteban@commure.com> | 2018-07-19 23:18:07 -0700 |
| commit | f53c145ef18db6543e8e5420e172e04b6054db2e (patch) | |
| tree | 9de9b0c1f029e7dfac14b0ab50181868f46bd9df /src/libstd/macros.rs | |
| parent | bc14d71622378cf942a834e7c2b5358b9901f775 (diff) | |
| download | rust-f53c145ef18db6543e8e5420e172e04b6054db2e.tar.gz rust-f53c145ef18db6543e8e5420e172e04b6054db2e.zip | |
Improve suggestion for missing fmt str in println
Avoid using `concat!(fmt, "\n")` to improve the diagnostics being emitted when the first `println!()` argument isn't a formatting string literal.
Diffstat (limited to 'src/libstd/macros.rs')
| -rw-r--r-- | src/libstd/macros.rs | 10 |
1 files changed, 8 insertions, 2 deletions
diff --git a/src/libstd/macros.rs b/src/libstd/macros.rs index 75f038407c1..a4a6ed73c61 100644 --- a/src/libstd/macros.rs +++ b/src/libstd/macros.rs @@ -155,8 +155,14 @@ macro_rules! print { #[stable(feature = "rust1", since = "1.0.0")] macro_rules! println { () => (print!("\n")); - ($fmt:expr) => (print!(concat!($fmt, "\n"))); - ($fmt:expr, $($arg:tt)*) => (print!(concat!($fmt, "\n"), $($arg)*)); + ($fmt:expr) => ({ + print!($fmt); + print!("\n"); + }); + ($fmt:expr, $($arg:tt)*) => ({ + print!($fmt, $($arg)*); + print!("\n"); + }); } /// Macro for printing to the standard error. |
