@@ -1545,8 +1545,8 @@ mod prim_ref {}
1545
1545
/// `NonNull<T>` are all ABI-compatible with each other.
1546
1546
/// - Any two `fn()` types with the same `extern` ABI string are ABI-compatible with each other.
1547
1547
/// - Any two 1-ZST types (types with size 0 and alignment 1) are ABI-compatible.
1548
- /// - A `repr(transparent)` type `T` that has no private fields and is not `#[non_exhaustive]` is
1549
- /// ABI-compatible with its unique non-1-ZST field (if there is such a field).
1548
+ /// - A `repr(transparent)` type `T` is ABI-compatible with its unique non-1-ZST field (if there is
1549
+ /// such a field).
1550
1550
/// - `i32` is ABI-compatible with `NonZeroI32`, and similar for all other integer types with their
1551
1551
/// matching `NonZero*` type.
1552
1552
/// - If `T` is guaranteed to be subject to the [null pointer
@@ -1560,6 +1560,13 @@ mod prim_ref {}
1560
1560
/// the remaining bits in the register that are not used by the value. `i32` vs `f32` has already
1561
1561
/// been mentioned above.
1562
1562
///
1563
+ /// Note that these rules describe when two completely known types are ABI-compatible. When
1564
+ /// considering ABI compatibility of a type declared in another crate (including the standard
1565
+ /// library), consider that any type that has a private field or the `#[non_exhaustive]` attribute
1566
+ /// may change its layout as a non-breaking update unless documented otherwise -- so for instance,
1567
+ /// even if such a type is a 1-ZST or `repr(transparent)` right now, this might change with any
1568
+ /// library version change.
1569
+ ///
1563
1570
/// ### Trait implementations
1564
1571
///
1565
1572
/// In this documentation the shorthand `fn (T₁, T₂, …, Tₙ)` is used to represent non-variadic
0 commit comments