Rollup merge of #132003 - RalfJung:abi-compat-docs, r=traviscross · qinheping/verify-rust-std@2e8dd5b (original) (raw)

`@@ -1784,9 +1784,11 @@ mod prim_ref {}

`

1784

1784

`/// unique field that doesn't have size 0 and alignment 1 (if there is such a field).

`

1785

1785

`` /// - i32 is ABI-compatible with NonZero<i32>, and similar for all other integer types.

``

1786

1786

`` /// - 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,

``

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.

`

1790

1792

`///

`

1791

1793

`/// Furthermore, ABI compatibility satisfies the following general properties:

`

1792

1794

`///

`