mirror of
https://github.com/rust-lang/rust.git
synced 2025-10-27 11:05:06 +00:00
Attach range metadata to alignment loads from vtables ...because alignment is always nonzero[0]. This helps eliminate redundant runtime alignment checks, when a DST is a field of a struct whose remaining fields have alignment 1. Fixes #91438. --- [0]: The [reference](https://doc.rust-lang.org/reference/type-layout.html) says that alignment must be at least 1. And in practice, the alignment field for all vtables is generated here:772d51f887/compiler/rustc_middle/src/ty/vtable.rs (L68-L90)and is nonzero because [`Align::bytes()`](772d51f887/compiler/rustc_target/src/abi/mod.rs (L547-L549)) is always nonzero.