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_llvm/src/consts.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_llvm/src/consts.rs')
| -rw-r--r-- | compiler/rustc_codegen_llvm/src/consts.rs | 5 |
1 files changed, 4 insertions, 1 deletions
diff --git a/compiler/rustc_codegen_llvm/src/consts.rs b/compiler/rustc_codegen_llvm/src/consts.rs index 413ef0ba764..cb4073528e1 100644 --- a/compiler/rustc_codegen_llvm/src/consts.rs +++ b/compiler/rustc_codegen_llvm/src/consts.rs @@ -109,7 +109,10 @@ pub fn const_alloc_to_llvm<'ll>(cx: &CodegenCx<'ll, '_>, alloc: ConstAllocation< Pointer::new(alloc_id, Size::from_bytes(ptr_offset)), &cx.tcx, ), - Scalar { value: Primitive::Pointer, valid_range: WrappingRange { start: 0, end: !0 } }, + Scalar::Initialized { + value: Primitive::Pointer, + valid_range: WrappingRange::full(dl.pointer_size), + }, cx.type_i8p_ext(address_space), )); next_offset = offset + pointer_size; |
