diff options
| author | Aleksey Kladov <aleksey.kladov@gmail.com> | 2019-07-09 15:26:18 +0300 |
|---|---|---|
| committer | Aleksey Kladov <aleksey.kladov@gmail.com> | 2019-07-09 15:26:18 +0300 |
| commit | 8175a1f905d1bf8ffd33c1be48476161d30b885e (patch) | |
| tree | 155e4687acd3bf9a4ba65cf921356e39aba782f6 | |
| parent | 88953840ac9fc3e7f90af537b8b4177b76ae0d87 (diff) | |
| download | rust-8175a1f905d1bf8ffd33c1be48476161d30b885e.tar.gz rust-8175a1f905d1bf8ffd33c1be48476161d30b885e.zip | |
clarify that debug_assert does not completely omits the code
TIL that debug_assert is implemented using `if cfg!(debug_assertions)` rather than `#[cfg(debug_assertions)]`. This means one can not use API gated with `#[cfg(debug_assertions)]` in `debug_assert` family of macros.
| -rw-r--r-- | src/libcore/macros.rs | 12 |
1 files changed, 6 insertions, 6 deletions
diff --git a/src/libcore/macros.rs b/src/libcore/macros.rs index 58ea0207c56..da28afd97c3 100644 --- a/src/libcore/macros.rs +++ b/src/libcore/macros.rs @@ -145,11 +145,11 @@ macro_rules! assert_ne { /// # Uses /// /// 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 not execute /// `debug_assert!` statements unless `-C debug-assertions` is passed to the /// compiler. This makes `debug_assert!` useful for checks that are too /// expensive to be present in a release build but may be helpful during -/// development. +/// development. `debug_assert!` statements are always type checked. /// /// An unchecked assertion allows a program in an inconsistent state to keep /// running, which might have unexpected consequences but does not introduce @@ -190,11 +190,11 @@ macro_rules! debug_assert { /// debug representations. /// /// Unlike [`assert_eq!`], `debug_assert_eq!` statements are only enabled in non -/// optimized builds by default. An optimized build will omit all +/// optimized builds by default. An optimized build will not execute /// `debug_assert_eq!` statements unless `-C debug-assertions` is passed to the /// compiler. This makes `debug_assert_eq!` useful for checks that are too /// expensive to be present in a release build but may be helpful during -/// development. +/// development. `debug_assert_eq!` statements are always type checked. /// /// [`assert_eq!`]: ../std/macro.assert_eq.html /// @@ -217,11 +217,11 @@ macro_rules! debug_assert_eq { /// debug representations. /// /// Unlike [`assert_ne!`], `debug_assert_ne!` statements are only enabled in non -/// optimized builds by default. An optimized build will omit all +/// optimized builds by default. An optimized build will not execute /// `debug_assert_ne!` statements unless `-C debug-assertions` is passed to the /// compiler. This makes `debug_assert_ne!` useful for checks that are too /// expensive to be present in a release build but may be helpful during -/// development. +/// development. `debug_assert_ne!` statements are always type checked. /// /// [`assert_ne!`]: ../std/macro.assert_ne.html /// |
