Permit use of mem::uninitialized via allow(deprecated)

This commit is contained in:
Mark Rousskov 2019-07-04 11:24:56 -04:00
parent 8a7dded1a2
commit 007d87f171
20 changed files with 30 additions and 9 deletions

View file

@ -7,6 +7,7 @@ use std::mem;
fn foo<const SIZE: usize>() {
let arr: [u8; SIZE] = unsafe {
#[allow(deprecated)]
let mut array: [u8; SIZE] = mem::uninitialized();
array
};

View file

@ -1,6 +1,7 @@
// This note is annotated because the purpose of the test
// is to ensure that certain other notes are not generated.
#![deny(unused_unsafe)] //~ NOTE
#![allow(deprecated)]
// (test that no note is generated on this unsafe fn)
pub unsafe fn a() {

View file

@ -1,5 +1,5 @@
error: unnecessary `unsafe` block
--> $DIR/issue-48131.rs:8:9
--> $DIR/issue-48131.rs:9:9
|
LL | unsafe { /* unnecessary */ }
| ^^^^^^ unnecessary `unsafe` block
@ -11,7 +11,7 @@ LL | #![deny(unused_unsafe)]
| ^^^^^^^^^^^^^
error: unnecessary `unsafe` block
--> $DIR/issue-48131.rs:19:13
--> $DIR/issue-48131.rs:20:13
|
LL | unsafe { /* unnecessary */ }
| ^^^^^^ unnecessary `unsafe` block

View file

@ -1,3 +1,5 @@
#![allow(deprecated)]
enum Void {}
fn main() {

View file

@ -1,5 +1,5 @@
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 {
| ^ 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
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 {};
| ^
@ -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
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 {};
| ^
@ -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
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 {};
| ^
@ -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
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 {
| ^ 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
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 {
| ^ 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
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;
| ^^^^^ pattern `Err(_)` not covered