Update compiler/rustc_mir_transform/src/gvn.rs

Co-authored-by: Michael Goulet <michael@errs.io>
This commit is contained in:
Camille Gillot 2024-07-06 12:45:23 +02:00 committed by GitHub
parent b97f83b27f
commit 12edc8db87
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194

View File

@ -1396,8 +1396,8 @@ fn op_to_prop_const<'tcx>(
// by `GlobalAlloc::Memory`, so do fall through to copying if needed.
// FIXME: find a way to treat this more uniformly (probably by fixing codegen)
if let GlobalAlloc::Memory(alloc) = ecx.tcx.global_alloc(alloc_id)
// Transmuting a constant is just an offset in the allocation. If the alignement of the
// allocation is noe enough, fallback to copying into a properly aligned value.
// Transmuting a constant is just an offset in the allocation. If the alignment of the
// allocation is not enough, fallback to copying into a properly aligned value.
&& alloc.inner().align >= op.layout.align.abi
{
return Some(ConstValue::Indirect { alloc_id, offset });