Skip to content

Commit

Permalink
Rollup merge of rust-lang#128240 - mbrubeck:patch-3, r=joboet
Browse files Browse the repository at this point in the history
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.
  • Loading branch information
GuillaumeGomez authored Jul 28, 2024
2 parents ee5956f + 1c64fd3 commit eeb76cc
Showing 1 changed file with 18 additions and 0 deletions.
18 changes: 18 additions & 0 deletions library/core/src/macros/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,12 @@ macro_rules! panic {

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

/// Asserts that two expressions are not equal to each other (using [`PartialEq`]).
///
/// Assertions are always checked in both debug and release builds, and cannot
/// be disabled. See [`debug_assert_ne!`] for assertions that are disabled in
/// release builds by default.
///
/// [`debug_assert_ne!`]: crate::debug_assert_ne
///
/// On panic, this macro will print the values of the expressions with their
/// debug representations.
///
Expand Down Expand Up @@ -122,6 +134,12 @@ macro_rules! assert_ne {
/// optional if guard can be used to add additional checks that must be true for the matched value,
/// otherwise this macro will panic.
///
/// Assertions are always checked in both debug and release builds, and cannot
/// be disabled. See [`debug_assert_matches!`] for assertions that are disabled in
/// release builds by default.
///
/// [`debug_assert_matches!`]: crate::assert_matches::debug_assert_matches
///
/// 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.
Expand Down

0 comments on commit eeb76cc

Please sign in to comment.