diff options
| author | Mara Bos <m-ou.se@m-ou.se> | 2021-03-04 19:36:36 +0100 |
|---|---|---|
| committer | Mara Bos <m-ou.se@m-ou.se> | 2021-03-04 19:36:36 +0100 |
| commit | f223affd7ae383816a038700d591d78bebd98d46 (patch) | |
| tree | 2ce45bc73bc1bc60aead892a961594ccc3df9715 | |
| parent | 5bd1204fc2a3147d425bc98fc0fefb00c6b4702d (diff) | |
| download | rust-f223affd7ae383816a038700d591d78bebd98d46.tar.gz rust-f223affd7ae383816a038700d591d78bebd98d46.zip | |
Don't consume the expression in assert_matches!()'s failure case.
| -rw-r--r-- | library/core/src/macros/mod.rs | 8 |
1 files changed, 4 insertions, 4 deletions
diff --git a/library/core/src/macros/mod.rs b/library/core/src/macros/mod.rs index b0b35c6915f..fb43433a794 100644 --- a/library/core/src/macros/mod.rs +++ b/library/core/src/macros/mod.rs @@ -141,9 +141,9 @@ macro_rules! assert_matches { ($left:expr, $( $pattern:pat )|+ $( if $guard: expr )? $(,)?) => ({ match $left { $( $pattern )|+ $( if $guard )? => {} - left_val => { + ref left_val => { $crate::panicking::assert_matches_failed( - &left_val, + left_val, $crate::stringify!($($pattern)|+ $(if $guard)?), $crate::option::Option::None ); @@ -153,9 +153,9 @@ macro_rules! assert_matches { ($left:expr, $( $pattern:pat )|+ $( if $guard: expr )?, $($arg:tt)+) => ({ match $left { $( $pattern )|+ $( if $guard )? => {} - left_val => { + ref left_val => { $crate::panicking::assert_matches_failed( - &left_val, + left_val, $crate::stringify!($($pattern)|+ $(if $guard)?), $crate::option::Option::Some($crate::format_args!($($arg)+)) ); |
