Skip to content

Commit 5c7362c

Browse files
committed
note rustc-specific details
1 parent 7b76cc3 commit 5c7362c

File tree

1 file changed

+6
-4
lines changed

1 file changed

+6
-4
lines changed

src/behavior-considered-undefined.md

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -52,10 +52,10 @@ code.
5252
* Slice metadata is invalid if if the length is not a valid `usize`
5353
(i.e., it must not be read from uninitialized memory).
5454
* Non-UTF-8 byte sequences in a `str`.
55-
* Invalid values for a type with a custom definition of invalid values, such
56-
as a `NonNull<T>` that is null. (Requesting custom invalid values is an
57-
unstable feature, but some stable libstd types, like `NonNull`, make use of
58-
it.)
55+
* Invalid values for a type with a custom definition of invalid values.
56+
57+
> **Note**: For `rustc`, those types are [`NonNull<T>`] and [`NonZero*`].
58+
> Requesting custom invalid types requires the unstable `rustc_layout_scalar_valid_range_*` attributes.
5959
6060
> **Note**: Undefined behavior affects the entire program. For example, calling
6161
> a function in C that exhibits undefined behavior of C means your entire
@@ -78,3 +78,5 @@ large. In particular, allocations and therefore slices cannot be bigger than
7878
[`target_feature`]: attributes/codegen.md#the-target_feature-attribute
7979
[`UnsafeCell<U>`]: ../std/cell/struct.UnsafeCell.html
8080
[Rustonomicon]: ../nomicon/index.html
81+
[`NonNull<T>`]: ../core/ptr/struct.NonNull.html
82+
[`NonZero*`]: ../core/num/index.html

0 commit comments

Comments
 (0)