Skip to content

Commit 6b3cc92

Browse files
committed
Auto merge of #142837 - saethlin:maybeuninit-codegen, r=<try>
MaybeImprove MaybeUninit I'm investigating possible solutions to #139355.
2 parents 6d0c9e2 + 1e1bc5f commit 6b3cc92

File tree

2 files changed

+1
-9
lines changed

2 files changed

+1
-9
lines changed

compiler/rustc_codegen_ssa/src/mir/rvalue.rs

Lines changed: 0 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -95,14 +95,6 @@ impl<'a, 'tcx, Bx: BuilderMethods<'a, 'tcx>> FunctionCx<'a, 'tcx, Bx> {
9595
if let mir::Operand::Constant(const_op) = elem {
9696
let val = self.eval_mir_constant(const_op);
9797
if val.all_bytes_uninit(self.cx.tcx()) {
98-
let size = bx.const_usize(dest.layout.size.bytes());
99-
bx.memset(
100-
dest.val.llval,
101-
bx.const_undef(bx.type_i8()),
102-
size,
103-
dest.val.align,
104-
MemFlags::empty(),
105-
);
10698
return;
10799
}
108100
}

library/core/src/mem/maybe_uninit.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -328,7 +328,7 @@ impl<T> MaybeUninit<T> {
328328
#[inline(always)]
329329
#[rustc_diagnostic_item = "maybe_uninit_uninit"]
330330
pub const fn uninit() -> MaybeUninit<T> {
331-
MaybeUninit { uninit: () }
331+
const { MaybeUninit { uninit: () } }
332332
}
333333

334334
/// Creates a new `MaybeUninit<T>` in an uninitialized state, with the memory being

0 commit comments

Comments
 (0)