Skip to content

Commit 242b2d2

Browse files
committed
modify style for check
1 parent cc4c14b commit 242b2d2

File tree

1 file changed

+4
-1
lines changed

1 file changed

+4
-1
lines changed

src/type-layout.md

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -601,7 +601,10 @@ When borrowing a field of a `repr(packed(...))` struct, Rust must not create a *
601601
- It is a **hard error** (E0793) to create a reference whose **ABI alignment requirement** is **greater** than the struct’s packed alignment.
602602
- Borrowing is **allowed** if the target’s ABI alignment is **less than or equal to** the struct’s packed alignment.
603603

604-
For array and slice fields `[T; N]` and `[T]`, the ABI alignment equals that of the element type `T` and **does not depend on the length `N`**. (Sketch: from `&[T]` one can obtain `&T`, hence `align([T]) ≥ align(T)`; from `&T` one can obtain `&[T; 1]` via `std::array::from_ref`, hence `align(T) ≥ align([T])`. Therefore `align([T]) == align(T)`.)
604+
For array and slice fields `` `[T; N]` `` and `` `[T]` ``, the ABI alignment equals that of the element type `` `T` `` and **does not depend on the length** `` `N` ``.
605+
*(Sketch: from `` `&[T]` `` one can obtain `` `&T` ``, hence `` `align([T])` ```` `align(T)` ``;
606+
from `` `&T` `` one can obtain `` `&[T; 1]` `` via `` `std::array::from_ref` ``, hence `` `align(T)` ```` `align([T])` ``.
607+
Therefore `` `align([T]) == align(T)` ``.)*
605608

606609
**Examples**
607610

0 commit comments

Comments
 (0)