@@ -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:
@@ -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