@@ -177,7 +177,7 @@ for interfacing with the C programming language.
177
177
This representation can be applied to structs, unions, and enums. The exception
178
178
is [ zero-variant enums] for which the ` C ` representation is an error.
179
179
180
- #### \ #[ repr(C)] Structs
180
+ #### ` #[repr(C)] ` Structs
181
181
182
182
The alignment of the struct is the alignment of the most-aligned field in it.
183
183
@@ -244,7 +244,7 @@ the sake of clarity. To perform memory layout computations in actual code, use
244
244
> they are fields that have the ` [[no_unique_address]] ` attribute, in which
245
245
> case they do not increase the overall size of the struct.
246
246
247
- #### \ #[ repr(C)] Unions
247
+ #### ` #[repr(C)] ` Unions
248
248
249
249
A union declared with ` #[repr(C)] ` will have the same size and alignment as an
250
250
equivalent C union declaration in the C language for the target platform.
@@ -274,7 +274,7 @@ assert_eq!(std::mem::size_of::<SizeRoundedUp>(), 8); // Size of 6 from b,
274
274
assert_eq! (std :: mem :: align_of :: <SizeRoundedUp >(), 4 ); // From a
275
275
```
276
276
277
- #### \ #[ repr(C)] Field-less Enums
277
+ #### ` #[repr(C)] ` Field-less Enums
278
278
279
279
For [ field-less enums] , the ` C ` representation has the size and alignment of
280
280
the default ` enum ` size and alignment for the target platform's C ABI.
@@ -295,7 +295,7 @@ using a field-less enum in FFI to model a C `enum` is often wrong.
295
295
296
296
</div >
297
297
298
- #### \ #[ repr(C)] Enums With Fields
298
+ #### ` #[repr(C)] ` Enums With Fields
299
299
300
300
The representation of a ` repr(C) ` enum with fields is a ` repr(C) ` struct with
301
301
two fields, also called a "tagged union" in C:
@@ -369,7 +369,7 @@ the primitive integer types. That is: `u8`, `u16`, `u32`, `u64`, `u128`,
369
369
370
370
Primitive representations can only be applied to enumerations and have
371
371
different behavior whether the enum has fields or no fields. It is an error
372
- for [ zero-variant enumerations ] to have a primitive representation. Combining
372
+ for [ zero-variant enums ] to have a primitive representation. Combining
373
373
two primitive representations together is an error.
374
374
375
375
#### Primitive Representation of Field-less Enums
@@ -433,7 +433,7 @@ struct MyVariantD(MyEnumDiscriminant);
433
433
434
434
> Note: ` union ` s with non-` Copy ` fields are unstable, see [ 55149] .
435
435
436
- #### Combining primitive representations of enums with fields and \ #[ repr(C)]
436
+ #### Combining primitive representations of enums with fields and ` #[repr(C)] `
437
437
438
438
For enums with fields, it is also possible to combine ` repr(C) ` and a
439
439
primitive representation (e.g., ` repr(C, u8) ` ). This modifies the [ ` repr(C) ` ] by
0 commit comments