diff options
| author | ismailarilik <arilik.ismail@gmail.com> | 2025-04-25 10:17:27 +0300 |
|---|---|---|
| committer | ismailarilik <arilik.ismail@gmail.com> | 2025-04-25 10:17:27 +0300 |
| commit | 49cb451b5d2cb2cd9be1cc5685531d70c28ae4dd (patch) | |
| tree | 8ba97500c5ee3fdc417518b5d42f8f7032556b9e | |
| parent | f820b75feef00654924c9351a2faca8d34818339 (diff) | |
| download | rust-49cb451b5d2cb2cd9be1cc5685531d70c28ae4dd.tar.gz rust-49cb451b5d2cb2cd9be1cc5685531d70c28ae4dd.zip | |
docs(std): mention const blocks in const keyword doc page
| -rw-r--r-- | library/std/src/keyword_docs.rs | 9 |
1 files changed, 8 insertions, 1 deletions
diff --git a/library/std/src/keyword_docs.rs b/library/std/src/keyword_docs.rs index c07c391892d..91701576130 100644 --- a/library/std/src/keyword_docs.rs +++ b/library/std/src/keyword_docs.rs @@ -119,7 +119,7 @@ mod break_keyword {} #[doc(keyword = "const")] // -/// Compile-time constants, compile-time evaluable functions, and raw pointers. +/// Compile-time constants, compile-time blocks, compile-time evaluable functions, and raw pointers. /// /// ## Compile-time constants /// @@ -166,6 +166,12 @@ mod break_keyword {} /// /// For more detail on `const`, see the [Rust Book] or the [Reference]. /// +/// ## Compile-time blocks +/// +/// The `const` keyword can also be used to define a block of code that is evaluated at compile time. +/// This is useful for ensuring certain computations are completed before optimizations happen, as well as +/// before runtime. For more details, see the [Reference][const-blocks]. +/// /// ## Compile-time evaluable functions /// /// The other main use of the `const` keyword is in `const fn`. This marks a function as being @@ -184,6 +190,7 @@ mod break_keyword {} /// [pointer primitive]: pointer /// [Rust Book]: ../book/ch03-01-variables-and-mutability.html#constants /// [Reference]: ../reference/items/constant-items.html +/// [const-blocks]: ../reference/expressions/block-expr.html#const-blocks /// [const-eval]: ../reference/const_eval.html mod const_keyword {} |
