Skip to content

Commit f77a028

Browse files
Revert "Add debug_assert_matches macro."
This reverts commit 0a8e401.
1 parent 4923e56 commit f77a028

File tree

2 files changed

+2
-38
lines changed

2 files changed

+2
-38
lines changed

library/core/src/macros/mod.rs

-36
Original file line numberDiff line numberDiff line change
@@ -208,42 +208,6 @@ macro_rules! debug_assert_ne {
208208
($($arg:tt)*) => (if $crate::cfg!(debug_assertions) { $crate::assert_ne!($($arg)*); })
209209
}
210210

211-
/// Asserts that an expression matches any of the given patterns.
212-
///
213-
/// Like in a `match` expression, the pattern can be optionally followed by `if`
214-
/// and a guard expression that has access to names bound by the pattern.
215-
///
216-
/// On panic, this macro will print the value of the expression with its
217-
/// debug representation.
218-
///
219-
/// Unlike [`assert_matches!`], `debug_assert_matches!` statements are only
220-
/// enabled in non optimized builds by default. An optimized build will not
221-
/// execute `debug_assert_matches!` statements unless `-C debug-assertions` is
222-
/// passed to the compiler. This makes `debug_assert_matches!` useful for
223-
/// checks that are too expensive to be present in a release build but may be
224-
/// helpful during development. The result of expanding `debug_assert_matches!`
225-
/// is always type checked.
226-
///
227-
/// # Examples
228-
///
229-
/// ```
230-
/// #![feature(assert_matches)]
231-
///
232-
/// let a = 1u32.checked_add(2);
233-
/// let b = 1u32.checked_sub(2);
234-
/// debug_assert_matches!(a, Some(_));
235-
/// debug_assert_matches!(b, None);
236-
///
237-
/// let c = Ok("abc".to_string());
238-
/// debug_assert_matches!(c, Ok(x) | Err(x) if x.len() < 100);
239-
/// ```
240-
#[macro_export]
241-
#[unstable(feature = "assert_matches", issue = "82775")]
242-
#[allow_internal_unstable(assert_matches)]
243-
macro_rules! debug_assert_matches {
244-
($($arg:tt)*) => (if $crate::cfg!(debug_assertions) { $crate::assert_matches!($($arg)*); })
245-
}
246-
247211
/// Returns whether the given expression matches any of the given patterns.
248212
///
249213
/// Like in a `match` expression, the pattern can be optionally followed by `if`

library/std/src/lib.rs

+2-2
Original file line numberDiff line numberDiff line change
@@ -558,8 +558,8 @@ pub use std_detect::detect;
558558
#[stable(feature = "rust1", since = "1.0.0")]
559559
#[allow(deprecated, deprecated_in_future)]
560560
pub use core::{
561-
assert_eq, assert_ne, debug_assert, debug_assert_eq, debug_assert_matches, debug_assert_ne,
562-
matches, r#try, todo, unimplemented, unreachable, write, writeln,
561+
assert_eq, assert_ne, debug_assert, debug_assert_eq, debug_assert_ne, matches, r#try, todo,
562+
unimplemented, unreachable, write, writeln,
563563
};
564564

565565
// Re-export built-in macros defined through libcore.

0 commit comments

Comments
 (0)