Skip to content

Commit 53ba56a

Browse files
authored
Merge pull request #229 from lzutao/patch-1
Prefer ::MAX associated constant over `max_value()`
2 parents 1e374df + 5f9bb24 commit 53ba56a

File tree

1 file changed

+3
-3
lines changed

1 file changed

+3
-3
lines changed

reference/src/layout/scalars.md

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -49,17 +49,17 @@ They have the same layout as the [pointer types] for which the pointee is
4949
> **Note**: in the current Rust implementation, the layouts of `isize` and
5050
> `usize` determine the following:
5151
>
52-
> * the maximum size of Rust _allocations_ is limited to `isize::max_value()`.
52+
> * the maximum size of Rust _allocations_ is limited to `isize::MAX`.
5353
> The LLVM `getelementptr` instruction uses signed-integer field offsets. Rust
5454
> calls `getelementptr` with the `inbounds` flag which assumes that field
5555
> offsets do not overflow,
5656
>
57-
> * the maximum number of elements in an array is `usize::max_value()` (`[T; N:
57+
> * the maximum number of elements in an array is `usize::MAX` (`[T; N:
5858
> usize]`. Only ZST arrays can probably be this large in practice, non-ZST
5959
> arrays are bound by the maximum size of Rust values,
6060
>
6161
> * the maximum value in bytes by which a pointer can be offseted using
62-
> `ptr.add` or `ptr.offset` is `isize::max_value()`.
62+
> `ptr.add` or `ptr.offset` is `isize::MAX`.
6363
>
6464
> These limits have not gone through the RFC process and are not guaranteed to
6565
> hold.

0 commit comments

Comments
 (0)