Skip to content
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.

Commit 5b78bae

Browse files
committedJul 26, 2024
Add links from assert_eq! docs to debug_assert_eq!, etc.
This adds information and links from the docs for the following macros to their debug-only versions: * `assert_eq!` * `assert_ne!` * `assert_matches!` This matches the existing documentation for the `assert!` macro.
1 parent 22ce603 commit 5b78bae

File tree

1 file changed

+18
-0
lines changed

1 file changed

+18
-0
lines changed
 

‎core/src/macros/mod.rs

+18
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,12 @@ macro_rules! panic {
1414

1515
/// Asserts that two expressions are equal to each other (using [`PartialEq`]).
1616
///
17+
/// Assertions are always checked in both debug and release builds, and cannot
18+
/// be disabled. See [`debug_assert_eq!`] for assertions that are disabled in
19+
/// release builds by default.
20+
///
21+
/// [`debug_assert_eq!`]: crate::debug_assert_eq
22+
///
1723
/// On panic, this macro will print the values of the expressions with their
1824
/// debug representations.
1925
///
@@ -64,6 +70,12 @@ macro_rules! assert_eq {
6470

6571
/// Asserts that two expressions are not equal to each other (using [`PartialEq`]).
6672
///
73+
/// Assertions are always checked in both debug and release builds, and cannot
74+
/// be disabled. See [`debug_assert_ne!`] for assertions that are disabled in
75+
/// release builds by default.
76+
///
77+
/// [`debug_assert_ne!`]: crate::debug_assert_ne
78+
///
6779
/// On panic, this macro will print the values of the expressions with their
6880
/// debug representations.
6981
///
@@ -122,6 +134,12 @@ macro_rules! assert_ne {
122134
/// optional if guard can be used to add additional checks that must be true for the matched value,
123135
/// otherwise this macro will panic.
124136
///
137+
/// Assertions are always checked in both debug and release builds, and cannot
138+
/// be disabled. See [`debug_assert_matches!`] for assertions that are disabled in
139+
/// release builds by default.
140+
///
141+
/// [`debug_assert_matches!`]: crate::assert_matches::debug_assert_matches
142+
///
125143
/// On panic, this macro will print the value of the expression with its debug representation.
126144
///
127145
/// Like [`assert!`], this macro has a second form, where a custom panic message can be provided.

0 commit comments

Comments
 (0)
Failed to load comments.