about summary refs log tree commit diff
path: root/library/std
diff options
context:
space:
mode:
authorMatthias Krüger <476013+matthiaskrgr@users.noreply.github.com>2025-04-25 17:31:47 +0200
committerGitHub <noreply@github.com>2025-04-25 17:31:47 +0200
commit394cdca40f6804e3e29d4897f049bfe114879183 (patch)
tree3747f54a9e578e5f7f86cd173e4c3cc973e26b28 /library/std
parenta35379654c4ccaddfdb93601d86c896b5824c76e (diff)
parent49cb451b5d2cb2cd9be1cc5685531d70c28ae4dd (diff)
downloadrust-394cdca40f6804e3e29d4897f049bfe114879183.tar.gz
rust-394cdca40f6804e3e29d4897f049bfe114879183.zip
Rollup merge of #139572 - ismailarilik:docs/std/mention-const-blocks-in-const-keyword-doc-page, r=tgross35
docs(std): mention const blocks in const keyword doc page

Aims to close #139549
Diffstat (limited to 'library/std')
-rw-r--r--library/std/src/keyword_docs.rs9
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 {}