Skip to content

Commit 49cb451

Browse files
committed
docs(std): mention const blocks in const keyword doc page
1 parent f820b75 commit 49cb451

File tree

1 file changed

+8
-1
lines changed

1 file changed

+8
-1
lines changed

library/std/src/keyword_docs.rs

+8-1
Original file line numberDiff line numberDiff line change
@@ -119,7 +119,7 @@ mod break_keyword {}
119119

120120
#[doc(keyword = "const")]
121121
//
122-
/// Compile-time constants, compile-time evaluable functions, and raw pointers.
122+
/// Compile-time constants, compile-time blocks, compile-time evaluable functions, and raw pointers.
123123
///
124124
/// ## Compile-time constants
125125
///
@@ -166,6 +166,12 @@ mod break_keyword {}
166166
///
167167
/// For more detail on `const`, see the [Rust Book] or the [Reference].
168168
///
169+
/// ## Compile-time blocks
170+
///
171+
/// The `const` keyword can also be used to define a block of code that is evaluated at compile time.
172+
/// This is useful for ensuring certain computations are completed before optimizations happen, as well as
173+
/// before runtime. For more details, see the [Reference][const-blocks].
174+
///
169175
/// ## Compile-time evaluable functions
170176
///
171177
/// 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 {}
184190
/// [pointer primitive]: pointer
185191
/// [Rust Book]: ../book/ch03-01-variables-and-mutability.html#constants
186192
/// [Reference]: ../reference/items/constant-items.html
193+
/// [const-blocks]: ../reference/expressions/block-expr.html#const-blocks
187194
/// [const-eval]: ../reference/const_eval.html
188195
mod const_keyword {}
189196

0 commit comments

Comments
 (0)