Skip to content

Commit dc97326

Browse files
committed
Update docs to show [expr; N] can repeat const expr
1 parent 49b9cc5 commit dc97326

File tree

2 files changed

+8
-4
lines changed

2 files changed

+8
-4
lines changed

library/core/src/primitive_docs.rs

+4-2
Original file line numberDiff line numberDiff line change
@@ -587,8 +587,10 @@ mod prim_pointer {}
587587
/// There are two syntactic forms for creating an array:
588588
///
589589
/// * A list with each element, i.e., `[x, y, z]`.
590-
/// * A repeat expression `[x; N]`, which produces an array with `N` copies of `x`.
591-
/// The type of `x` must be [`Copy`].
590+
/// * A repeat expression `[expr; N]` where `N` is how many times to repeat `expr` in the array. `expr` must either be:
591+
///
592+
/// * A value of type `Copy`
593+
/// * A `const` value
592594
///
593595
/// Note that `[expr; 0]` is allowed, and produces an empty array.
594596
/// This will still evaluate `expr`, however, and immediately drop the resulting value, so

library/std/src/primitive_docs.rs

+4-2
Original file line numberDiff line numberDiff line change
@@ -587,8 +587,10 @@ mod prim_pointer {}
587587
/// There are two syntactic forms for creating an array:
588588
///
589589
/// * A list with each element, i.e., `[x, y, z]`.
590-
/// * A repeat expression `[x; N]`, which produces an array with `N` copies of `x`.
591-
/// The type of `x` must be [`Copy`].
590+
/// * A repeat expression `[expr; N]` where `N` is how many times to repeat `expr` in the array. `expr` must either be:
591+
///
592+
/// * A value of type `Copy`
593+
/// * A `const` value
592594
///
593595
/// Note that `[expr; 0]` is allowed, and produces an empty array.
594596
/// This will still evaluate `expr`, however, and immediately drop the resulting value, so

0 commit comments

Comments
 (0)