diff options
| author | bors <bors@rust-lang.org> | 2022-04-05 16:46:13 +0000 |
|---|---|---|
| committer | bors <bors@rust-lang.org> | 2022-04-05 16:46:13 +0000 |
| commit | f262ca12aac76152c4b46cefcf8300f0249a5eb2 (patch) | |
| tree | 50b8a31fd3869a4c0805e26f6a6f2127c9a82988 /compiler/rustc_codegen_gcc/src/builder.rs | |
| parent | d4c7839f73e4a84c75e8708adaafb9fafcb668f0 (diff) | |
| parent | d57b7559090266fc0db2616bcfe8286739ee131d (diff) | |
| download | rust-f262ca12aac76152c4b46cefcf8300f0249a5eb2.tar.gz rust-f262ca12aac76152c4b46cefcf8300f0249a5eb2.zip | |
Auto merge of #94527 - oli-obk:undef_scalars, r=nagisa,erikdesjardin
Let CTFE to handle partially uninitialized unions without marking the entire value as uninitialized. follow up to #94411 To fix https://github.com/rust-lang/rust/issues/69488 and by extension fix https://github.com/rust-lang/rust/issues/94371, we should stop treating types like `MaybeUninit<usize>` as something that the `Scalar` type in the interpreter engine can represent. So we add a new field to `abi::Primitive` that records whether the primitive is nested in a union cc `@RalfJung` r? `@ghost`
Diffstat (limited to 'compiler/rustc_codegen_gcc/src/builder.rs')
| -rw-r--r-- | compiler/rustc_codegen_gcc/src/builder.rs | 8 |
1 files changed, 4 insertions, 4 deletions
diff --git a/compiler/rustc_codegen_gcc/src/builder.rs b/compiler/rustc_codegen_gcc/src/builder.rs index 21c7d420b20..41f88f119e2 100644 --- a/compiler/rustc_codegen_gcc/src/builder.rs +++ b/compiler/rustc_codegen_gcc/src/builder.rs @@ -694,11 +694,11 @@ impl<'a, 'gcc, 'tcx> BuilderMethods<'a, 'tcx> for Builder<'a, 'gcc, 'tcx> { } fn scalar_load_metadata<'a, 'gcc, 'tcx>(bx: &mut Builder<'a, 'gcc, 'tcx>, load: RValue<'gcc>, scalar: &abi::Scalar) { - let vr = scalar.valid_range.clone(); - match scalar.value { + let vr = scalar.valid_range(bx); + match scalar.primitive() { abi::Int(..) => { if !scalar.is_always_valid(bx) { - bx.range_metadata(load, scalar.valid_range); + bx.range_metadata(load, vr); } } abi::Pointer if vr.start < vr.end && !vr.contains(0) => { @@ -720,7 +720,7 @@ impl<'a, 'gcc, 'tcx> BuilderMethods<'a, 'tcx> for Builder<'a, 'gcc, 'tcx> { OperandValue::Immediate(self.to_immediate(load, place.layout)) } else if let abi::Abi::ScalarPair(ref a, ref b) = place.layout.abi { - let b_offset = a.value.size(self).align_to(b.value.align(self).abi); + let b_offset = a.size(self).align_to(b.align(self).abi); let pair_type = place.layout.gcc_type(self, false); let mut load = |i, scalar: &abi::Scalar, align| { |
