Lines Matching full:alignment
101 Alignment, enumerator
106 /// The minimum possible alignment of a type.
112 /// The maximum theoretic possible alignment of a type.
123 /// The current, documented max alignment of a type \[1\].
125 /// \[1\] Per <https://doc.rust-lang.org/reference/type-layout.html#the-alignment-modifiers>:
127 /// The alignment value must be a power of two from 1 up to
163 /// If `self` describes the size and alignment of type that lacks static
165 /// accurately reflects the size, alignment, and lack of static shallow
172 /// alignment (or 1). If `repr_align` is provided, then it must be a power
243 // SAFETY: The alignment of a slice is equal to the alignment of its in for_slice()
265 /// given alignment modifiers and fields.
273 /// alignment modifiers and fields corresponding to that definition, the
299 // struct with `repr_align` or `repr_packed` alignment modifications and in for_repr_c_struct()
344 // If `repr_packed` is `None`, there are no alignment constraints, and in extend()
354 // in Rust's maximum allowed alignment. However, if such a change ever in extend()
365 // The field's alignment is clamped by `repr_packed` (i.e., the in extend()
368 // [1] Per https://doc.rust-lang.org/reference/type-layout.html#the-alignment-modifiers: in extend()
371 // fields, is the smaller of the specified alignment and the alignment in extend()
375 // The struct's alignment is the maximum of its previous alignment and in extend()
386 // satisfy the field's alignment, and offset of the trailing in extend()
389 … // [1] Per https://doc.rust-lang.org/reference/type-layout.html#the-alignment-modifiers: in extend()
393 // altered) alignment. in extend()
462 /// up to the nearest multiple of this type's alignment or `repr_packed`
497 // needed to satisfy alignment. in pad_to_align()
545 /// Validates that the size and alignment requirements of a type with the
563 /// alignment requirement
565 /// `self`'s alignment requirement (as a consequence, since all instances
566 /// of the type are a multiple of its alignment, no size for the type will
579 /// - `addr` satisfies `self`'s alignment
583 /// - `addr + split_at` satisfies `self`'s alignment
646 // Alignment checks go in their own block to avoid introducing variables in validate_cast_and_convert_metadata()
649 // We check alignment for `addr` (for prefix casts) or `addr + in validate_cast_and_convert_metadata()
655 // a multiple of the alignment (and by safety precondition, we know in validate_cast_and_convert_metadata()
672 return Err(MetadataCastError::Alignment); in validate_cast_and_convert_metadata()
686 // multiple of the alignment, or will be larger than in validate_cast_and_convert_metadata()
720 // required to satisfy the alignment. Note that we have computed in validate_cast_and_convert_metadata()
731 // up to the next multiple of the alignment will bring in validate_cast_and_convert_metadata()
808 /// `Src`'s alignment must not be smaller than `Dst`'s alignment. in project()
1125 // with a zero-sized trailing field of given alignment `n`. The macro in test_dst_layout_extend_sized_with_sized()
1126 // tests that the resulting layout has both size and alignment `min(n, in test_dst_layout_extend_sized_with_sized()
1473 test!(layout(_, [2]).validate(ODDS, _, Prefix), Ok(Err(MetadataCastError::Alignment))); in test_validate_cast_and_convert_metadata()
1474 test!(layout(_, [2]).validate(ODDS, _, Prefix), Ok(Err(MetadataCastError::Alignment))); in test_validate_cast_and_convert_metadata()
1477 test!(layout(_, [2]).validate(EVENS, ODDS, Suffix), Ok(Err(MetadataCastError::Alignment))); in test_validate_cast_and_convert_metadata()
1478 test!(layout(_, [2]).validate(EVENS, ODDS, Suffix), Ok(Err(MetadataCastError::Alignment))); in test_validate_cast_and_convert_metadata()
1639 // of their alignment. If the macro created a type like in test_validate_rust_layout()
1690 // requested a larger alignment, `Foo` may actually be larger in test_validate_rust_layout()
1696 // alignment. in test_validate_rust_layout()
2075 // The field's alignment is clamped by `max_align` (i.e., the in prove_dst_layout_extend()
2078 // [1] Per https://doc.rust-lang.org/reference/type-layout.html#the-alignment-modifiers: in prove_dst_layout_extend()
2081 // fields, is the smaller of the specified alignment and the in prove_dst_layout_extend()
2082 // alignment of the field's type. in prove_dst_layout_extend()
2085 // The struct's alignment is the maximum of its previous alignment and in prove_dst_layout_extend()
2090 // satisfy the field's alignment, and offset of the trailing field. in prove_dst_layout_extend()
2093 // [1] Per https://doc.rust-lang.org/reference/type-layout.html#the-alignment-modifiers: in prove_dst_layout_extend()
2096 // order to satisfy each field's (possibly altered) alignment. in prove_dst_layout_extend()
2200 // Calling `pad_to_align` does not alter the `DstLayout`'s alignment. in prove_dst_layout_pad_to_align()
2207 // trailing padding needed to satisfy its alignment in prove_dst_layout_pad_to_align()