mirror of
https://github.com/rust-lang/rust.git
synced 2026-05-29 20:46:07 +03:00
Explain why vtable generation needs no alignment checks
This commit is contained in:
@@ -59,6 +59,9 @@ pub fn get_vtable(
|
||||
|
||||
let drop = ::monomorphize::resolve_drop_in_place(*tcx, ty);
|
||||
let drop = self.memory.create_fn_alloc(drop).with_default_tag();
|
||||
// no need to do any alignment checks on the memory accesses below, because we know the
|
||||
// allocation is correctly aligned as we created it above. Also we're only offsetting by
|
||||
// multiples of `ptr_align`, which means that it will stay aligned to `ptr_align`.
|
||||
self.memory
|
||||
.get_mut(vtable.alloc_id)?
|
||||
.write_ptr_sized(tcx, vtable, Scalar::Ptr(drop).into())?;
|
||||
|
||||
Reference in New Issue
Block a user