diff options
| author | bors <bors@rust-lang.org> | 2021-05-03 20:56:34 +0000 |
|---|---|---|
| committer | bors <bors@rust-lang.org> | 2021-05-03 20:56:34 +0000 |
| commit | 88f19c6dab716c6281af7602e30f413e809c5974 (patch) | |
| tree | f7af4b32537043e9dfbdd884f811ee8fe0122d90 /library/core/src/macros/mod.rs | |
| parent | 9a1dfd2dc5c42a2ee84b4606aa08cdadf8c0ee87 (diff) | |
| parent | 47c7b9c5788055ddbbb59d0d1fc909af7b48668d (diff) | |
| download | rust-1.52.0.tar.gz rust-1.52.0.zip | |
Auto merge of #84864 - Mark-Simulacrum:stable-next, r=Mark-Simulacrum 1.52.0
[stable] 1.52.0 release This includes the release notes (#84183) as well as cherry-picked commits from: * [beta] revert PR #77885 #84710 * [beta] remove assert_matches #84759 * Revert PR 81473 to resolve (on beta) issues 81626 and 81658. #83171 * [beta] rustdoc revert deref recur #84868 * Fix ICE of for-loop mut borrowck where no suggestions are available #83401 Additionally in "fresh work" we're also: * reverting: directly expose copy and copy_nonoverlapping intrinsics #81238 to avoid https://github.com/rust-lang/rust/issues/84297 on 1.52
Diffstat (limited to 'library/core/src/macros/mod.rs')
| -rw-r--r-- | library/core/src/macros/mod.rs | 90 |
1 files changed, 0 insertions, 90 deletions
diff --git a/library/core/src/macros/mod.rs b/library/core/src/macros/mod.rs index 99894b5605e..a0a8eecbc25 100644 --- a/library/core/src/macros/mod.rs +++ b/library/core/src/macros/mod.rs @@ -110,60 +110,6 @@ macro_rules! assert_ne { }); } -/// Asserts that an expression matches any of the given patterns. -/// -/// Like in a `match` expression, the pattern can be optionally followed by `if` -/// and a guard expression that has access to names bound by the pattern. -/// -/// On panic, this macro will print the value of the expression with its -/// debug representation. -/// -/// Like [`assert!`], this macro has a second form, where a custom -/// panic message can be provided. -/// -/// # Examples -/// -/// ``` -/// #![feature(assert_matches)] -/// -/// let a = 1u32.checked_add(2); -/// let b = 1u32.checked_sub(2); -/// assert_matches!(a, Some(_)); -/// assert_matches!(b, None); -/// -/// let c = Ok("abc".to_string()); -/// assert_matches!(c, Ok(x) | Err(x) if x.len() < 100); -/// ``` -#[macro_export] -#[unstable(feature = "assert_matches", issue = "82775")] -#[allow_internal_unstable(core_panic)] -macro_rules! assert_matches { - ($left:expr, $( $pattern:pat )|+ $( if $guard: expr )? $(,)?) => ({ - match $left { - $( $pattern )|+ $( if $guard )? => {} - ref left_val => { - $crate::panicking::assert_matches_failed( - left_val, - $crate::stringify!($($pattern)|+ $(if $guard)?), - $crate::option::Option::None - ); - } - } - }); - ($left:expr, $( $pattern:pat )|+ $( if $guard: expr )?, $($arg:tt)+) => ({ - match $left { - $( $pattern )|+ $( if $guard )? => {} - ref left_val => { - $crate::panicking::assert_matches_failed( - left_val, - $crate::stringify!($($pattern)|+ $(if $guard)?), - $crate::option::Option::Some($crate::format_args!($($arg)+)) - ); - } - } - }); -} - /// Asserts that a boolean expression is `true` at runtime. /// /// This will invoke the [`panic!`] macro if the provided expression cannot be @@ -262,42 +208,6 @@ macro_rules! debug_assert_ne { ($($arg:tt)*) => (if $crate::cfg!(debug_assertions) { $crate::assert_ne!($($arg)*); }) } -/// Asserts that an expression matches any of the given patterns. -/// -/// Like in a `match` expression, the pattern can be optionally followed by `if` -/// and a guard expression that has access to names bound by the pattern. -/// -/// On panic, this macro will print the value of the expression with its -/// debug representation. -/// -/// Unlike [`assert_matches!`], `debug_assert_matches!` statements are only -/// enabled in non optimized builds by default. An optimized build will not -/// execute `debug_assert_matches!` statements unless `-C debug-assertions` is -/// passed to the compiler. This makes `debug_assert_matches!` useful for -/// checks that are too expensive to be present in a release build but may be -/// helpful during development. The result of expanding `debug_assert_matches!` -/// is always type checked. -/// -/// # Examples -/// -/// ``` -/// #![feature(assert_matches)] -/// -/// let a = 1u32.checked_add(2); -/// let b = 1u32.checked_sub(2); -/// debug_assert_matches!(a, Some(_)); -/// debug_assert_matches!(b, None); -/// -/// let c = Ok("abc".to_string()); -/// debug_assert_matches!(c, Ok(x) | Err(x) if x.len() < 100); -/// ``` -#[macro_export] -#[unstable(feature = "assert_matches", issue = "82775")] -#[allow_internal_unstable(assert_matches)] -macro_rules! debug_assert_matches { - ($($arg:tt)*) => (if $crate::cfg!(debug_assertions) { $crate::assert_matches!($($arg)*); }) -} - /// Returns whether the given expression matches any of the given patterns. /// /// Like in a `match` expression, the pattern can be optionally followed by `if` |
