Permit use of mem::uninitialized via allow(deprecated)
This commit is contained in:
parent
8a7dded1a2
commit
007d87f171
20 changed files with 30 additions and 9 deletions
|
@ -170,6 +170,7 @@ impl CodegenCx<'ll, 'tcx> {
|
||||||
pub fn const_get_real(&self, v: &'ll Value) -> Option<(f64, bool)> {
|
pub fn const_get_real(&self, v: &'ll Value) -> Option<(f64, bool)> {
|
||||||
unsafe {
|
unsafe {
|
||||||
if self.is_const_real(v) {
|
if self.is_const_real(v) {
|
||||||
|
#[allow(deprecated)]
|
||||||
let mut loses_info: llvm::Bool = ::std::mem::uninitialized();
|
let mut loses_info: llvm::Bool = ::std::mem::uninitialized();
|
||||||
let r = llvm::LLVMConstRealGetDouble(v, &mut loses_info);
|
let r = llvm::LLVMConstRealGetDouble(v, &mut loses_info);
|
||||||
let loses_info = if loses_info == 1 { true } else { false };
|
let loses_info = if loses_info == 1 { true } else { false };
|
||||||
|
|
|
@ -44,6 +44,7 @@ pub fn copy<R: ?Sized, W: ?Sized>(reader: &mut R, writer: &mut W) -> io::Result<
|
||||||
where R: Read, W: Write
|
where R: Read, W: Write
|
||||||
{
|
{
|
||||||
let mut buf = unsafe {
|
let mut buf = unsafe {
|
||||||
|
#[allow(deprecated)]
|
||||||
let mut buf: [u8; super::DEFAULT_BUF_SIZE] = mem::uninitialized();
|
let mut buf: [u8; super::DEFAULT_BUF_SIZE] = mem::uninitialized();
|
||||||
reader.initializer().initialize(&mut buf);
|
reader.initializer().initialize(&mut buf);
|
||||||
buf
|
buf
|
||||||
|
|
|
@ -1,3 +1,5 @@
|
||||||
|
#![allow(deprecated)] // mem::uninitialized
|
||||||
|
|
||||||
use crate::io::ErrorKind;
|
use crate::io::ErrorKind;
|
||||||
use crate::mem;
|
use crate::mem;
|
||||||
|
|
||||||
|
|
|
@ -3,6 +3,8 @@
|
||||||
//! This module contains the facade (aka platform-specific) implementations of
|
//! This module contains the facade (aka platform-specific) implementations of
|
||||||
//! OS level functionality for Fortanix SGX.
|
//! OS level functionality for Fortanix SGX.
|
||||||
|
|
||||||
|
#![allow(deprecated)]
|
||||||
|
|
||||||
use crate::io::ErrorKind;
|
use crate::io::ErrorKind;
|
||||||
use crate::os::raw::c_char;
|
use crate::os::raw::c_char;
|
||||||
use crate::sync::atomic::{AtomicBool, Ordering};
|
use crate::sync::atomic::{AtomicBool, Ordering};
|
||||||
|
|
|
@ -108,6 +108,7 @@ impl<T: Write + Send + 'static> WinConsole<T> {
|
||||||
let fg;
|
let fg;
|
||||||
let bg;
|
let bg;
|
||||||
unsafe {
|
unsafe {
|
||||||
|
#[allow(deprecated)]
|
||||||
let mut buffer_info = ::std::mem::uninitialized();
|
let mut buffer_info = ::std::mem::uninitialized();
|
||||||
if GetConsoleScreenBufferInfo(GetStdHandle(-11i32 as DWORD), &mut buffer_info) != 0 {
|
if GetConsoleScreenBufferInfo(GetStdHandle(-11i32 as DWORD), &mut buffer_info) != 0 {
|
||||||
fg = bits_to_color(buffer_info.wAttributes);
|
fg = bits_to_color(buffer_info.wAttributes);
|
||||||
|
|
|
@ -1,6 +1,7 @@
|
||||||
use std::mem;
|
use std::mem;
|
||||||
|
|
||||||
fn main() {
|
fn main() {
|
||||||
|
#[allow(deprecated)]
|
||||||
let xs: [u8; 4] = unsafe { mem::uninitialized() };
|
let xs: [u8; 4] = unsafe { mem::uninitialized() };
|
||||||
let y = xs[0] + xs[1];
|
let y = xs[0] + xs[1];
|
||||||
}
|
}
|
||||||
|
|
|
@ -2,6 +2,7 @@
|
||||||
fn main() {
|
fn main() {
|
||||||
// Check that the tail statement in the body unifies with something
|
// Check that the tail statement in the body unifies with something
|
||||||
for _ in 0..3 {
|
for _ in 0..3 {
|
||||||
|
#[allow(deprecated)]
|
||||||
unsafe { std::mem::uninitialized() }
|
unsafe { std::mem::uninitialized() }
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -4,6 +4,7 @@ trait FromUnchecked {
|
||||||
|
|
||||||
impl FromUnchecked for [u8; 1] {
|
impl FromUnchecked for [u8; 1] {
|
||||||
unsafe fn from_unchecked() {
|
unsafe fn from_unchecked() {
|
||||||
|
#[allow(deprecated)]
|
||||||
let mut array: Self = std::mem::uninitialized();
|
let mut array: Self = std::mem::uninitialized();
|
||||||
let _ptr = &mut array as *mut [u8] as *mut u8;
|
let _ptr = &mut array as *mut [u8] as *mut u8;
|
||||||
}
|
}
|
||||||
|
|
|
@ -3,6 +3,7 @@
|
||||||
// in a runtime panic.
|
// in a runtime panic.
|
||||||
|
|
||||||
#![feature(never_type)]
|
#![feature(never_type)]
|
||||||
|
#![allow(deprecated)]
|
||||||
|
|
||||||
use std::{mem, panic};
|
use std::{mem, panic};
|
||||||
|
|
||||||
|
|
|
@ -49,6 +49,7 @@ fn main() {
|
||||||
#[allow(unconditional_recursion)]
|
#[allow(unconditional_recursion)]
|
||||||
fn recurse(array: &[u64]) {
|
fn recurse(array: &[u64]) {
|
||||||
unsafe { black_box(array.as_ptr() as u64); }
|
unsafe { black_box(array.as_ptr() as u64); }
|
||||||
|
#[allow(deprecated)]
|
||||||
let local: [_; 1024] = unsafe { mem::uninitialized() };
|
let local: [_; 1024] = unsafe { mem::uninitialized() };
|
||||||
recurse(&local);
|
recurse(&local);
|
||||||
}
|
}
|
||||||
|
|
|
@ -69,6 +69,7 @@ fn main() {
|
||||||
unsafe {
|
unsafe {
|
||||||
// This should be safe, because we don't match on it unless it's fully formed,
|
// This should be safe, because we don't match on it unless it's fully formed,
|
||||||
// and it doesn't have a destructor.
|
// and it doesn't have a destructor.
|
||||||
|
#[allow(deprecated)]
|
||||||
let mut dest: MyEnum = mem::uninitialized();
|
let mut dest: MyEnum = mem::uninitialized();
|
||||||
while buf.len() > 0 {
|
while buf.len() > 0 {
|
||||||
match parse_my_enum(&mut dest, &mut buf) {
|
match parse_my_enum(&mut dest, &mut buf) {
|
||||||
|
|
|
@ -69,6 +69,7 @@ fn main() {
|
||||||
unsafe {
|
unsafe {
|
||||||
// This should be safe, because we don't match on it unless it's fully formed,
|
// This should be safe, because we don't match on it unless it's fully formed,
|
||||||
// and it doesn't have a destructor.
|
// and it doesn't have a destructor.
|
||||||
|
#[allow(deprecated)]
|
||||||
let mut dest: MyEnum = mem::uninitialized();
|
let mut dest: MyEnum = mem::uninitialized();
|
||||||
while buf.len() > 0 {
|
while buf.len() > 0 {
|
||||||
match parse_my_enum(&mut dest, &mut buf) {
|
match parse_my_enum(&mut dest, &mut buf) {
|
||||||
|
|
|
@ -65,6 +65,7 @@ fn main() {
|
||||||
unsafe {
|
unsafe {
|
||||||
// This should be safe, because we don't match on it unless it's fully formed,
|
// This should be safe, because we don't match on it unless it's fully formed,
|
||||||
// and it doesn't have a destructor.
|
// and it doesn't have a destructor.
|
||||||
|
#[allow(deprecated)]
|
||||||
let mut dest: MyEnum = mem::uninitialized();
|
let mut dest: MyEnum = mem::uninitialized();
|
||||||
while buf.len() > 0 {
|
while buf.len() > 0 {
|
||||||
match parse_my_enum(&mut dest, &mut buf) {
|
match parse_my_enum(&mut dest, &mut buf) {
|
||||||
|
|
|
@ -7,6 +7,7 @@ use std::mem;
|
||||||
#[derive(Clone)]
|
#[derive(Clone)]
|
||||||
struct Foo;
|
struct Foo;
|
||||||
|
|
||||||
|
#[allow(deprecated)]
|
||||||
pub fn main() {
|
pub fn main() {
|
||||||
unsafe {
|
unsafe {
|
||||||
let _x: Foo = mem::uninitialized();
|
let _x: Foo = mem::uninitialized();
|
||||||
|
|
|
@ -105,6 +105,7 @@ impl<U: Unsigned, B: Bit> Add<B0> for UInt<U, B> {
|
||||||
impl<U: Unsigned> Add<U> for UTerm {
|
impl<U: Unsigned> Add<U> for UTerm {
|
||||||
type Output = U;
|
type Output = U;
|
||||||
fn add(self, _: U) -> Self::Output {
|
fn add(self, _: U) -> Self::Output {
|
||||||
|
#[allow(deprecated)]
|
||||||
unsafe { ::std::mem::uninitialized() }
|
unsafe { ::std::mem::uninitialized() }
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -7,6 +7,7 @@ use std::mem;
|
||||||
|
|
||||||
fn foo<const SIZE: usize>() {
|
fn foo<const SIZE: usize>() {
|
||||||
let arr: [u8; SIZE] = unsafe {
|
let arr: [u8; SIZE] = unsafe {
|
||||||
|
#[allow(deprecated)]
|
||||||
let mut array: [u8; SIZE] = mem::uninitialized();
|
let mut array: [u8; SIZE] = mem::uninitialized();
|
||||||
array
|
array
|
||||||
};
|
};
|
||||||
|
|
|
@ -1,6 +1,7 @@
|
||||||
// This note is annotated because the purpose of the test
|
// This note is annotated because the purpose of the test
|
||||||
// is to ensure that certain other notes are not generated.
|
// is to ensure that certain other notes are not generated.
|
||||||
#![deny(unused_unsafe)] //~ NOTE
|
#![deny(unused_unsafe)] //~ NOTE
|
||||||
|
#![allow(deprecated)]
|
||||||
|
|
||||||
// (test that no note is generated on this unsafe fn)
|
// (test that no note is generated on this unsafe fn)
|
||||||
pub unsafe fn a() {
|
pub unsafe fn a() {
|
||||||
|
|
|
@ -1,5 +1,5 @@
|
||||||
error: unnecessary `unsafe` block
|
error: unnecessary `unsafe` block
|
||||||
--> $DIR/issue-48131.rs:8:9
|
--> $DIR/issue-48131.rs:9:9
|
||||||
|
|
|
|
||||||
LL | unsafe { /* unnecessary */ }
|
LL | unsafe { /* unnecessary */ }
|
||||||
| ^^^^^^ unnecessary `unsafe` block
|
| ^^^^^^ unnecessary `unsafe` block
|
||||||
|
@ -11,7 +11,7 @@ LL | #![deny(unused_unsafe)]
|
||||||
| ^^^^^^^^^^^^^
|
| ^^^^^^^^^^^^^
|
||||||
|
|
||||||
error: unnecessary `unsafe` block
|
error: unnecessary `unsafe` block
|
||||||
--> $DIR/issue-48131.rs:19:13
|
--> $DIR/issue-48131.rs:20:13
|
||||||
|
|
|
|
||||||
LL | unsafe { /* unnecessary */ }
|
LL | unsafe { /* unnecessary */ }
|
||||||
| ^^^^^^ unnecessary `unsafe` block
|
| ^^^^^^ unnecessary `unsafe` block
|
||||||
|
|
|
@ -1,3 +1,5 @@
|
||||||
|
#![allow(deprecated)]
|
||||||
|
|
||||||
enum Void {}
|
enum Void {}
|
||||||
|
|
||||||
fn main() {
|
fn main() {
|
||||||
|
|
|
@ -1,5 +1,5 @@
|
||||||
error[E0004]: non-exhaustive patterns: `Err(_)` not covered
|
error[E0004]: non-exhaustive patterns: `Err(_)` not covered
|
||||||
--> $DIR/uninhabited-matches-feature-gated.rs:5:19
|
--> $DIR/uninhabited-matches-feature-gated.rs:7:19
|
||||||
|
|
|
|
||||||
LL | let _ = match x {
|
LL | let _ = match x {
|
||||||
| ^ pattern `Err(_)` not covered
|
| ^ pattern `Err(_)` not covered
|
||||||
|
@ -7,7 +7,7 @@ LL | let _ = match x {
|
||||||
= help: ensure that all possible cases are being handled, possibly by adding wildcards or more match arms
|
= help: ensure that all possible cases are being handled, possibly by adding wildcards or more match arms
|
||||||
|
|
||||||
error[E0004]: non-exhaustive patterns: type `&Void` is non-empty
|
error[E0004]: non-exhaustive patterns: type `&Void` is non-empty
|
||||||
--> $DIR/uninhabited-matches-feature-gated.rs:10:19
|
--> $DIR/uninhabited-matches-feature-gated.rs:12:19
|
||||||
|
|
|
|
||||||
LL | let _ = match x {};
|
LL | let _ = match x {};
|
||||||
| ^
|
| ^
|
||||||
|
@ -15,7 +15,7 @@ LL | let _ = match x {};
|
||||||
= help: ensure that all possible cases are being handled, possibly by adding wildcards or more match arms
|
= help: ensure that all possible cases are being handled, possibly by adding wildcards or more match arms
|
||||||
|
|
||||||
error[E0004]: non-exhaustive patterns: type `(Void,)` is non-empty
|
error[E0004]: non-exhaustive patterns: type `(Void,)` is non-empty
|
||||||
--> $DIR/uninhabited-matches-feature-gated.rs:13:19
|
--> $DIR/uninhabited-matches-feature-gated.rs:15:19
|
||||||
|
|
|
|
||||||
LL | let _ = match x {};
|
LL | let _ = match x {};
|
||||||
| ^
|
| ^
|
||||||
|
@ -23,7 +23,7 @@ LL | let _ = match x {};
|
||||||
= help: ensure that all possible cases are being handled, possibly by adding wildcards or more match arms
|
= help: ensure that all possible cases are being handled, possibly by adding wildcards or more match arms
|
||||||
|
|
||||||
error[E0004]: non-exhaustive patterns: type `[Void; 1]` is non-empty
|
error[E0004]: non-exhaustive patterns: type `[Void; 1]` is non-empty
|
||||||
--> $DIR/uninhabited-matches-feature-gated.rs:16:19
|
--> $DIR/uninhabited-matches-feature-gated.rs:18:19
|
||||||
|
|
|
|
||||||
LL | let _ = match x {};
|
LL | let _ = match x {};
|
||||||
| ^
|
| ^
|
||||||
|
@ -31,7 +31,7 @@ LL | let _ = match x {};
|
||||||
= help: ensure that all possible cases are being handled, possibly by adding wildcards or more match arms
|
= help: ensure that all possible cases are being handled, possibly by adding wildcards or more match arms
|
||||||
|
|
||||||
error[E0004]: non-exhaustive patterns: `&[_]` not covered
|
error[E0004]: non-exhaustive patterns: `&[_]` not covered
|
||||||
--> $DIR/uninhabited-matches-feature-gated.rs:19:19
|
--> $DIR/uninhabited-matches-feature-gated.rs:21:19
|
||||||
|
|
|
|
||||||
LL | let _ = match x {
|
LL | let _ = match x {
|
||||||
| ^ pattern `&[_]` not covered
|
| ^ pattern `&[_]` not covered
|
||||||
|
@ -39,7 +39,7 @@ LL | let _ = match x {
|
||||||
= help: ensure that all possible cases are being handled, possibly by adding wildcards or more match arms
|
= help: ensure that all possible cases are being handled, possibly by adding wildcards or more match arms
|
||||||
|
|
||||||
error[E0004]: non-exhaustive patterns: `Err(_)` not covered
|
error[E0004]: non-exhaustive patterns: `Err(_)` not covered
|
||||||
--> $DIR/uninhabited-matches-feature-gated.rs:27:19
|
--> $DIR/uninhabited-matches-feature-gated.rs:29:19
|
||||||
|
|
|
|
||||||
LL | let _ = match x {
|
LL | let _ = match x {
|
||||||
| ^ pattern `Err(_)` not covered
|
| ^ pattern `Err(_)` not covered
|
||||||
|
@ -47,7 +47,7 @@ LL | let _ = match x {
|
||||||
= help: ensure that all possible cases are being handled, possibly by adding wildcards or more match arms
|
= help: ensure that all possible cases are being handled, possibly by adding wildcards or more match arms
|
||||||
|
|
||||||
error[E0005]: refutable pattern in local binding: `Err(_)` not covered
|
error[E0005]: refutable pattern in local binding: `Err(_)` not covered
|
||||||
--> $DIR/uninhabited-matches-feature-gated.rs:32:9
|
--> $DIR/uninhabited-matches-feature-gated.rs:34:9
|
||||||
|
|
|
|
||||||
LL | let Ok(x) = x;
|
LL | let Ok(x) = x;
|
||||||
| ^^^^^ pattern `Err(_)` not covered
|
| ^^^^^ pattern `Err(_)` not covered
|
||||||
|
|
Loading…
Add table
Reference in a new issue