Skip to content

Commit bd747ee

Browse files
committed
Separate guaranteed from non guaranteed behavior in call ABI examples
1 parent afebd1c commit bd747ee

File tree

1 file changed

+10
-14
lines changed

1 file changed

+10
-14
lines changed

reference/src/glossary.md

+10-14
Original file line numberDiff line numberDiff line change
@@ -106,34 +106,30 @@ pub enum Abi {
106106
}
107107
```
108108

109-
where
109+
where:
110110

111111
```rust,norun
112112
enum Integer { I8, I16, I32, I64, I128, }
113113
enum FloatTy { F32, F64, }
114114
115-
enum Primitive {
115+
enum Scalar {
116116
Int(Integer, /*signedness:*/ bool),
117117
Float(FloatTy),
118118
Pointer
119119
}
120-
121-
struct Scalar {
122-
value: Primitive,
123-
valid_range: RangeInclusive<u128>,
124-
}
125120
```
126121

127-
For example, right now, the call ABI of:
122+
For example, the call ABI of:
128123

129124
* `i32` is `Scalar`,
130-
* `struct Wrapper(i32);` (without `repr(transparent)`) is also `Scalar` (only larger `struct`s are aggregates),
131-
* `#[repr(C)] struct Wrapper(i32);` is `Aggregate { sized: true }` - required by `repr(C****.
125+
* `#[repr(C)] struct Wrapper(i32);` is `Aggregate { sized: true }`.
126+
* `#[repr(transparent)] struct Wrapper(i32);` is `Scalar`.
127+
128+
The call ABI of `repr(Rust)` types is unspecified. The following is not
129+
guaranteed, but right now the call ABI of:
132130

133-
**NOTE**: the call ABI of `repr(Rust)` types is unspecified, so the "call ABI"
134-
of `repr(Rust)` types is not guaranteed and `unsafe` code shall not rely on it.
135-
That is, code that requires `struct Wrapper(i32);` to have the same ABI as `i32`
136-
needs to use `repr(transparent)`. f
131+
* `/*#[repr(Rust)]*/ struct Wrapper(i32);` (without `repr(transparent)`) is also
132+
`Scalar` - only larger `struct`s are aggregates.
137133

138134
### TODO
139135

0 commit comments

Comments
 (0)