Skip to content

Commit 8499ec3

Browse files
committed
update ABI compatibility docs for new option-like rules
1 parent e2b2c3a commit 8499ec3

File tree

1 file changed

+5
-3
lines changed

1 file changed

+5
-3
lines changed

core/src/primitive_docs.rs

+5-3
Original file line numberDiff line numberDiff line change
@@ -1784,9 +1784,11 @@ mod prim_ref {}
17841784
/// unique field that doesn't have size 0 and alignment 1 (if there is such a field).
17851785
/// - `i32` is ABI-compatible with `NonZero<i32>`, and similar for all other integer types.
17861786
/// - If `T` is guaranteed to be subject to the [null pointer
1787-
/// optimization](option/index.html#representation), then `T` and `Option<T>` are ABI-compatible.
1788-
/// Furthermore, if `U` satisfies the requirements [outlined here](result/index.html#representation),
1789-
/// then `T` and `Result<T, U>` and `Result<U, T>` are all ABI-compatible.
1787+
/// optimization](option/index.html#representation), and `E` is an enum satisfying the following
1788+
/// requirements, then `T` and `E` are ABI-compatible. Such an enum `E` is called "option-like".
1789+
/// - The enum `E` has exactly two variants.
1790+
/// - One variant has exactly one field, of type `T`.
1791+
/// - All fields of the other variant are zero-sized with 1-byte alignment.
17901792
///
17911793
/// Furthermore, ABI compatibility satisfies the following general properties:
17921794
///

0 commit comments

Comments
 (0)