Removed use of intrinsics::uninit from tests.

This is in preperation for https://github.com/rust-lang/rust/pull/62150

Also allows deprecations in preperations for intrinsics::init being deprecated, which is a planned future step.
This commit is contained in:
Alex Gaynor 2019-06-29 09:34:42 -04:00
parent e3cb40e4f7
commit fffdbc0e8f
2 changed files with 8 additions and 21 deletions

View file

@ -1,8 +1,8 @@
#![allow(unused)]
#![allow(deprecated, unused)]
#![feature(core_intrinsics)]
extern crate core;
use std::intrinsics::{init, uninit};
use std::intrinsics::init;
fn main() {
let x = 1;
@ -12,7 +12,6 @@ fn main() {
ref_to_zeroed_intr(&x);
ref_to_uninit_std(&x);
ref_to_uninit_core(&x);
ref_to_uninit_intr(&x);
some_ref();
std_zeroed_no_ref();
core_zeroed_no_ref();
@ -40,10 +39,6 @@ unsafe fn ref_to_uninit_core<T: ?Sized>(t: &T) {
let ref_uninit: &T = core::mem::uninitialized(); // warning
}
unsafe fn ref_to_uninit_intr<T: ?Sized>(t: &T) {
let ref_uninit: &T = std::intrinsics::uninit(); // warning
}
fn some_ref() {
let some_ref = &1;
}

View file

@ -1,5 +1,5 @@
error: reference to zeroed memory
--> $DIR/invalid_ref.rs:24:24
--> $DIR/invalid_ref.rs:23:24
|
LL | let ref_zero: &T = std::mem::zeroed(); // warning
| ^^^^^^^^^^^^^^^^^^
@ -8,7 +8,7 @@ LL | let ref_zero: &T = std::mem::zeroed(); // warning
= help: Creation of a null reference is undefined behavior; see https://doc.rust-lang.org/reference/behavior-considered-undefined.html
error: reference to zeroed memory
--> $DIR/invalid_ref.rs:28:24
--> $DIR/invalid_ref.rs:27:24
|
LL | let ref_zero: &T = core::mem::zeroed(); // warning
| ^^^^^^^^^^^^^^^^^^^
@ -16,7 +16,7 @@ LL | let ref_zero: &T = core::mem::zeroed(); // warning
= help: Creation of a null reference is undefined behavior; see https://doc.rust-lang.org/reference/behavior-considered-undefined.html
error: reference to zeroed memory
--> $DIR/invalid_ref.rs:32:24
--> $DIR/invalid_ref.rs:31:24
|
LL | let ref_zero: &T = std::intrinsics::init(); // warning
| ^^^^^^^^^^^^^^^^^^^^^^^
@ -24,7 +24,7 @@ LL | let ref_zero: &T = std::intrinsics::init(); // warning
= help: Creation of a null reference is undefined behavior; see https://doc.rust-lang.org/reference/behavior-considered-undefined.html
error: reference to uninitialized memory
--> $DIR/invalid_ref.rs:36:26
--> $DIR/invalid_ref.rs:35:26
|
LL | let ref_uninit: &T = std::mem::uninitialized(); // warning
| ^^^^^^^^^^^^^^^^^^^^^^^^^
@ -32,20 +32,12 @@ LL | let ref_uninit: &T = std::mem::uninitialized(); // warning
= help: Creation of a null reference is undefined behavior; see https://doc.rust-lang.org/reference/behavior-considered-undefined.html
error: reference to uninitialized memory
--> $DIR/invalid_ref.rs:40:26
--> $DIR/invalid_ref.rs:39:26
|
LL | let ref_uninit: &T = core::mem::uninitialized(); // warning
| ^^^^^^^^^^^^^^^^^^^^^^^^^^
|
= help: Creation of a null reference is undefined behavior; see https://doc.rust-lang.org/reference/behavior-considered-undefined.html
error: reference to uninitialized memory
--> $DIR/invalid_ref.rs:44:26
|
LL | let ref_uninit: &T = std::intrinsics::uninit(); // warning
| ^^^^^^^^^^^^^^^^^^^^^^^^^
|
= help: Creation of a null reference is undefined behavior; see https://doc.rust-lang.org/reference/behavior-considered-undefined.html
error: aborting due to 6 previous errors
error: aborting due to 5 previous errors