Skip to content

Commit 007d87f

Browse files
Permit use of mem::uninitialized via allow(deprecated)
1 parent 8a7dded commit 007d87f

File tree

20 files changed

+30
-9
lines changed

20 files changed

+30
-9
lines changed

src/librustc_codegen_llvm/common.rs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -170,6 +170,7 @@ impl CodegenCx<'ll, 'tcx> {
170170
pub fn const_get_real(&self, v: &'ll Value) -> Option<(f64, bool)> {
171171
unsafe {
172172
if self.is_const_real(v) {
173+
#[allow(deprecated)]
173174
let mut loses_info: llvm::Bool = ::std::mem::uninitialized();
174175
let r = llvm::LLVMConstRealGetDouble(v, &mut loses_info);
175176
let loses_info = if loses_info == 1 { true } else { false };

src/libstd/io/util.rs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -44,6 +44,7 @@ pub fn copy<R: ?Sized, W: ?Sized>(reader: &mut R, writer: &mut W) -> io::Result<
4444
where R: Read, W: Write
4545
{
4646
let mut buf = unsafe {
47+
#[allow(deprecated)]
4748
let mut buf: [u8; super::DEFAULT_BUF_SIZE] = mem::uninitialized();
4849
reader.initializer().initialize(&mut buf);
4950
buf

src/libstd/sys/cloudabi/mod.rs

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,5 @@
1+
#![allow(deprecated)] // mem::uninitialized
2+
13
use crate::io::ErrorKind;
24
use crate::mem;
35

src/libstd/sys/sgx/mod.rs

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,8 @@
33
//! This module contains the facade (aka platform-specific) implementations of
44
//! OS level functionality for Fortanix SGX.
55
6+
#![allow(deprecated)]
7+
68
use crate::io::ErrorKind;
79
use crate::os::raw::c_char;
810
use crate::sync::atomic::{AtomicBool, Ordering};

src/libterm/win.rs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -108,6 +108,7 @@ impl<T: Write + Send + 'static> WinConsole<T> {
108108
let fg;
109109
let bg;
110110
unsafe {
111+
#[allow(deprecated)]
111112
let mut buffer_info = ::std::mem::uninitialized();
112113
if GetConsoleScreenBufferInfo(GetStdHandle(-11i32 as DWORD), &mut buffer_info) != 0 {
113114
fg = bits_to_color(buffer_info.wAttributes);
Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
use std::mem;
22

33
fn main() {
4+
#[allow(deprecated)]
45
let xs: [u8; 4] = unsafe { mem::uninitialized() };
56
let y = xs[0] + xs[1];
67
}

src/test/run-pass/for-loop-while/for-loop-has-unit-body.rs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,7 @@
22
fn main() {
33
// Check that the tail statement in the body unifies with something
44
for _ in 0..3 {
5+
#[allow(deprecated)]
56
unsafe { std::mem::uninitialized() }
67
}
78

src/test/run-pass/issues/issue-58212.rs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,7 @@ trait FromUnchecked {
44

55
impl FromUnchecked for [u8; 1] {
66
unsafe fn from_unchecked() {
7+
#[allow(deprecated)]
78
let mut array: Self = std::mem::uninitialized();
89
let _ptr = &mut array as *mut [u8] as *mut u8;
910
}

src/test/run-pass/panic-uninitialized-zeroed.rs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,7 @@
33
// in a runtime panic.
44

55
#![feature(never_type)]
6+
#![allow(deprecated)]
67

78
use std::{mem, panic};
89

src/test/run-pass/stack-probes.rs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -49,6 +49,7 @@ fn main() {
4949
#[allow(unconditional_recursion)]
5050
fn recurse(array: &[u64]) {
5151
unsafe { black_box(array.as_ptr() as u64); }
52+
#[allow(deprecated)]
5253
let local: [_; 1024] = unsafe { mem::uninitialized() };
5354
recurse(&local);
5455
}

0 commit comments

Comments
 (0)