Skip to content

docs(std): mention const blocks in const keyword doc page #139572

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
9 changes: 8 additions & 1 deletion library/std/src/keyword_docs.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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
///
Expand Down Expand Up @@ -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
Expand All @@ -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 {}

Expand Down
Loading