diff options
| author | Michael Lamparski <diagonaldevice@gmail.com> | 2018-02-07 09:31:22 -0500 |
|---|---|---|
| committer | Michael Lamparski <diagonaldevice@gmail.com> | 2018-02-07 09:36:20 -0500 |
| commit | 96eed862a08f0ee1d234f4f83419dd46fe58ccef (patch) | |
| tree | 9cf1209903f98f6a590bd44d7e089d15c767436f /src/libstd | |
| parent | 5fa97c35da2f0eeda4321da7fb5933490b798d79 (diff) | |
| download | rust-96eed862a08f0ee1d234f4f83419dd46fe58ccef.tar.gz rust-96eed862a08f0ee1d234f4f83419dd46fe58ccef.zip | |
libcore/libstd: fix commas in macro_rules! macros
BREAKING CHANGE: (or perhaps, *bugfix*)
In #![no_std] applications, the following calls to `panic!` used
to behave differently; they now behave the same.
Old behavior:
panic!("{{"); // panics with "{{"
panic!("{{",); // panics with "{"
New behavior:
panic!("{{"); // panics with "{{"
panic!("{{",); // panics with "{{"
This only affects calls to `panic!` (and by proxy `assert`
and `debug_assert`) with a single string literal followed by
a trailing comma, and only in `#![no_std]` applications.
Diffstat (limited to 'src/libstd')
| -rw-r--r-- | src/libstd/macros.rs | 3 |
1 files changed, 3 insertions, 0 deletions
diff --git a/src/libstd/macros.rs b/src/libstd/macros.rs index f058b1caef5..5a01674a3d0 100644 --- a/src/libstd/macros.rs +++ b/src/libstd/macros.rs @@ -68,6 +68,9 @@ macro_rules! panic { ($msg:expr) => ({ $crate::rt::begin_panic($msg, &(file!(), line!(), __rust_unstable_column!())) }); + ($msg:expr,) => ({ + panic!($msg) + }); ($fmt:expr, $($arg:tt)+) => ({ $crate::rt::begin_panic_fmt(&format_args!($fmt, $($arg)+), &(file!(), line!(), __rust_unstable_column!())) |
