Skip to content

Commit ce0915c

Browse files
authored
Move clause about abi-compatibility being an equivalence relation until after other clauses
1 parent 5be0423 commit ce0915c

File tree

1 file changed

+11
-11
lines changed

1 file changed

+11
-11
lines changed

src/abi.md

Lines changed: 11 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -26,16 +26,6 @@ Function calls pass parameters and return values between the caller and the call
2626
> If an invalid value is passed as a parameter or returned from a function, the result is immediate undefined behaviour, even if the parameter or return value is never used.
2727
> For example, passing a null pointer to a function that accepts a `NonNull<i32>` parameter via `fn(*const i32)` function pointer caused undefined behaviour.
2828
29-
r[abi.compatibility.equivalence]
30-
Two types `T` and `U` are *abi compatible* if:
31-
* They are the same type,
32-
* `U` is *abi compatible* with `T`, or
33-
* There exists a type `V`, such that `T` is *abi compatible* with `V` an `V` is *abi compatible* with `U`,
34-
35-
> [!NOTE]
36-
> These properties are respectively called "reflexivity", "symmetry", and "transitivity". They ensure that *abi compatibility* is an equivalence relation.
37-
> ABI compatibility is a pairwise relation between two types. With Transivity and Symmetry, however, it can be well-defined to refer to several types being ABI compatible
38-
3929
r[abi.compatibility.integer]
4030
Two [integer types] are *abi compatible* if they have the same width and the same signedness.
4131

@@ -136,13 +126,23 @@ r[abi.compatibility.discriminant]
136126
If `T` is an a type listed in [layout.repr.rust.option.elision], and `U` is the type of the *elision candidate field*, then `T` is layout compatible with `U`.
137127

138128
> [!NOTE]
139-
> `Option<U>`, `Result<U,Z>`, or `Result<Z,U>` are such types, when `U` are *elision candidate type*s, and `Z` is a 1-ZST type.
129+
> `Option<U>`, `Result<U,Z>`, or `Result<Z,U>` are examples of such types, when `U` are *elision candidate type*s, and `Z` is a 1-ZST type.
140130
>
141131
> Due to transitivity, two such types are *abi compatible* with each other if their *elision candidate field*s are *abi comaptible*
142132
143133
r[abi.compatibility.fn-ptr]
144134
A [function pointer] type `T` is *abi compatible* with an [function pointer] type `U` if `T` and `U` have *abi compatible* tags.
145135

136+
r[abi.compatibility.equivalence]
137+
Two types `T` and `U` are *abi compatible* if:
138+
* They are the same type,
139+
* `U` is *abi compatible* with `T`, or
140+
* There exists a type `V`, such that `T` is *abi compatible* with `V` an `V` is *abi compatible* with `U`,
141+
142+
> [!NOTE]
143+
> These properties are respectively called "reflexivity", "symmetry", and "transitivity". They ensure that *abi compatibility* is an equivalence relation.
144+
> ABI compatibility is a pairwise relation between two types. With Transivity and Symmetry, however, it can be well-defined to refer to several types being ABI compatible
145+
146146
r[abi.compatibility.extern-tag]
147147
Two [abi tags][abi tag] are *abi compatible* if:
148148
* They are the same string, or

0 commit comments

Comments
 (0)