rustc_layout_scalar_valid_range can be applied to scalar pairs and affects teh first scalar
This commit is contained in:
@@ -785,15 +785,7 @@ impl<'rt, 'mir, 'tcx: 'mir, M: Machine<'mir, 'tcx>> ValueVisitor<'mir, 'tcx, M>
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
Abi::ScalarPair(a_layout, b_layout) => {
|
Abi::ScalarPair(a_layout, b_layout) => {
|
||||||
// There is no `rustc_layout_scalar_valid_range_start` for pairs, so
|
if !a_layout.is_uninit_valid() && !b_layout.is_uninit_valid() {
|
||||||
// we would validate these things as we descend into the fields,
|
|
||||||
// but that can miss bugs in layout computation. Layout computation
|
|
||||||
// is subtle due to enums having ScalarPair layout, where one field
|
|
||||||
// is the discriminant.
|
|
||||||
if cfg!(debug_assertions)
|
|
||||||
&& !a_layout.is_uninit_valid()
|
|
||||||
&& !b_layout.is_uninit_valid()
|
|
||||||
{
|
|
||||||
// We can only proceed if *both* scalars need to be initialized.
|
// We can only proceed if *both* scalars need to be initialized.
|
||||||
// FIXME: find a way to also check ScalarPair when one side can be uninit but
|
// FIXME: find a way to also check ScalarPair when one side can be uninit but
|
||||||
// the other must be init.
|
// the other must be init.
|
||||||
|
|||||||
Reference in New Issue
Block a user