Mention in the docs, that assert!
has a second version with a custom message
I recently discovered that this is not mentioned in the docs, only in the examples, and it's not evident for people coming from C++ r? @steveklabnik
This commit is contained in:
parent
eab5ad529b
commit
ad8dcb64bf
1 changed files with 5 additions and 0 deletions
|
@ -34,6 +34,8 @@ macro_rules! panic {
|
||||||
/// This will invoke the `panic!` macro if the provided expression cannot be
|
/// This will invoke the `panic!` macro if the provided expression cannot be
|
||||||
/// evaluated to `true` at runtime.
|
/// evaluated to `true` at runtime.
|
||||||
///
|
///
|
||||||
|
/// This macro has a second version, where a custom panic message can be provided.
|
||||||
|
///
|
||||||
/// # Examples
|
/// # Examples
|
||||||
///
|
///
|
||||||
/// ```
|
/// ```
|
||||||
|
@ -99,6 +101,9 @@ macro_rules! assert_eq {
|
||||||
/// This will invoke the `panic!` macro if the provided expression cannot be
|
/// This will invoke the `panic!` macro if the provided expression cannot be
|
||||||
/// evaluated to `true` at runtime.
|
/// evaluated to `true` at runtime.
|
||||||
///
|
///
|
||||||
|
/// Like `assert!`, this macro also has a second version, where a custom panic
|
||||||
|
/// message can be provided.
|
||||||
|
///
|
||||||
/// Unlike `assert!`, `debug_assert!` statements are only enabled in non
|
/// Unlike `assert!`, `debug_assert!` statements are only enabled in non
|
||||||
/// optimized builds by default. An optimized build will omit all
|
/// optimized builds by default. An optimized build will omit all
|
||||||
/// `debug_assert!` statements unless `-C debug-assertions` is passed to the
|
/// `debug_assert!` statements unless `-C debug-assertions` is passed to the
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue