From 8a7dded1a249a21540583333204c378bf960a700 Mon Sep 17 00:00:00 2001 From: Mark Rousskov Date: Thu, 4 Jul 2019 10:05:50 -0400 Subject: [PATCH 1/2] Switch master to 1.38 --- src/bootstrap/channel.rs | 2 +- src/liballoc/alloc.rs | 3 +- src/liballoc/lib.rs | 1 - src/libcore/ffi.rs | 6 --- src/libcore/future/future.rs | 2 +- src/libcore/intrinsics.rs | 57 -------------------------- src/libcore/lib.rs | 2 +- src/libcore/mem/maybe_uninit.rs | 2 +- src/libcore/num/mod.rs | 2 +- src/libcore/ptr/non_null.rs | 2 +- src/librustc_data_structures/macros.rs | 4 +- src/librustc_resolve/lib.rs | 1 - src/libsyntax/tokenstream.rs | 11 ----- src/libunwind/build.rs | 8 ++-- src/libunwind/libunwind.rs | 10 ++--- src/stage0.txt | 2 +- 16 files changed, 17 insertions(+), 98 deletions(-) diff --git a/src/bootstrap/channel.rs b/src/bootstrap/channel.rs index 41235d911c0..8e8d8f5e787 100644 --- a/src/bootstrap/channel.rs +++ b/src/bootstrap/channel.rs @@ -13,7 +13,7 @@ use build_helper::output; use crate::Build; // The version number -pub const CFG_RELEASE_NUM: &str = "1.37.0"; +pub const CFG_RELEASE_NUM: &str = "1.38.0"; pub struct GitInfo { inner: Option, diff --git a/src/liballoc/alloc.rs b/src/liballoc/alloc.rs index 755feb84962..cef2b5eea34 100644 --- a/src/liballoc/alloc.rs +++ b/src/liballoc/alloc.rs @@ -15,8 +15,7 @@ extern "Rust" { // them from the `#[global_allocator]` attribute if there is one, or uses the // default implementations in libstd (`__rdl_alloc` etc in `src/libstd/alloc.rs`) // otherwise. - #[cfg_attr(bootstrap, allocator)] - #[cfg_attr(not(bootstrap), rustc_allocator)] + #[rustc_allocator] #[rustc_allocator_nounwind] fn __rust_alloc(size: usize, align: usize) -> *mut u8; #[rustc_allocator_nounwind] diff --git a/src/liballoc/lib.rs b/src/liballoc/lib.rs index bfe7d12d9d0..0750665c6b4 100644 --- a/src/liballoc/lib.rs +++ b/src/liballoc/lib.rs @@ -79,7 +79,6 @@ #![feature(coerce_unsized)] #![feature(dispatch_from_dyn)] #![feature(core_intrinsics)] -#![cfg_attr(bootstrap, feature(custom_attribute))] #![feature(dropck_eyepatch)] #![feature(exact_size_is_empty)] #![feature(fmt_internals)] diff --git a/src/libcore/ffi.rs b/src/libcore/ffi.rs index 49090fb8e43..4f87cc506ef 100644 --- a/src/libcore/ffi.rs +++ b/src/libcore/ffi.rs @@ -302,7 +302,6 @@ impl sealed_trait::VaArgSafe for *const T {} reason = "the `c_variadic` feature has not been properly tested on \ all supported platforms", issue = "44930")] -#[cfg(not(bootstrap))] impl<'f> VaListImpl<'f> { /// Advance to the next arg. #[inline] @@ -324,7 +323,6 @@ impl<'f> VaListImpl<'f> { reason = "the `c_variadic` feature has not been properly tested on \ all supported platforms", issue = "44930")] -#[cfg(not(bootstrap))] impl<'f> Clone for VaListImpl<'f> { #[inline] fn clone(&self) -> Self { @@ -340,7 +338,6 @@ impl<'f> Clone for VaListImpl<'f> { reason = "the `c_variadic` feature has not been properly tested on \ all supported platforms", issue = "44930")] -#[cfg(not(bootstrap))] impl<'f> Drop for VaListImpl<'f> { fn drop(&mut self) { // FIXME: this should call `va_end`, but there's no clean way to @@ -359,15 +356,12 @@ impl<'f> Drop for VaListImpl<'f> { extern "rust-intrinsic" { /// Destroy the arglist `ap` after initialization with `va_start` or /// `va_copy`. - #[cfg(not(bootstrap))] fn va_end(ap: &mut VaListImpl<'_>); /// Copies the current location of arglist `src` to the arglist `dst`. - #[cfg(not(bootstrap))] fn va_copy<'f>(dest: *mut VaListImpl<'f>, src: &VaListImpl<'f>); /// Loads an argument of type `T` from the `va_list` `ap` and increment the /// argument `ap` points to. - #[cfg(not(bootstrap))] fn va_arg(ap: &mut VaListImpl<'_>) -> T; } diff --git a/src/libcore/future/future.rs b/src/libcore/future/future.rs index acca8d7ba15..8bd1601a362 100644 --- a/src/libcore/future/future.rs +++ b/src/libcore/future/future.rs @@ -25,7 +25,7 @@ use crate::task::{Context, Poll}; #[doc(spotlight)] #[must_use = "futures do nothing unless you `.await` or poll them"] #[stable(feature = "futures_api", since = "1.36.0")] -#[cfg_attr(not(bootstrap), lang = "future_trait")] +#[lang = "future_trait"] pub trait Future { /// The type of value produced on completion. #[stable(feature = "futures_api", since = "1.36.0")] diff --git a/src/libcore/intrinsics.rs b/src/libcore/intrinsics.rs index b30eff8baa9..8e53022c287 100644 --- a/src/libcore/intrinsics.rs +++ b/src/libcore/intrinsics.rs @@ -1052,16 +1052,12 @@ extern "rust-intrinsic" { pub fn fabsf64(x: f64) -> f64; /// Returns the minimum of two `f32` values. - #[cfg(not(bootstrap))] pub fn minnumf32(x: f32, y: f32) -> f32; /// Returns the minimum of two `f64` values. - #[cfg(not(bootstrap))] pub fn minnumf64(x: f64, y: f64) -> f64; /// Returns the maximum of two `f32` values. - #[cfg(not(bootstrap))] pub fn maxnumf32(x: f32, y: f32) -> f32; /// Returns the maximum of two `f64` values. - #[cfg(not(bootstrap))] pub fn maxnumf64(x: f64, y: f64) -> f64; /// Copies the sign from `y` to `x` for `f32` values. @@ -1255,17 +1251,14 @@ extern "rust-intrinsic" { /// Returns the result of an unchecked addition, resulting in /// undefined behavior when `x + y > T::max_value()` or `x + y < T::min_value()`. - #[cfg(not(bootstrap))] pub fn unchecked_add(x: T, y: T) -> T; /// Returns the result of an unchecked substraction, resulting in /// undefined behavior when `x - y > T::max_value()` or `x - y < T::min_value()`. - #[cfg(not(bootstrap))] pub fn unchecked_sub(x: T, y: T) -> T; /// Returns the result of an unchecked multiplication, resulting in /// undefined behavior when `x * y > T::max_value()` or `x * y < T::min_value()`. - #[cfg(not(bootstrap))] pub fn unchecked_mul(x: T, y: T) -> T; /// Performs rotate left. @@ -1563,53 +1556,3 @@ pub unsafe fn write_bytes(dst: *mut T, val: u8, count: usize) { } write_bytes(dst, val, count) } - -// Simple bootstrap implementations of minnum/maxnum for stage0 compilation. - -/// Returns the minimum of two `f32` values. -#[cfg(bootstrap)] -pub fn minnumf32(x: f32, y: f32) -> f32 { - // IEEE754 says: minNum(x, y) is the canonicalized number x if x < y, y if y < x, the - // canonicalized number if one operand is a number and the other a quiet NaN. Otherwise it - // is either x or y, canonicalized (this means results might differ among implementations). - // When either x or y is a signaling NaN, then the result is according to 6.2. - // - // Since we do not support sNaN in Rust yet, we do not need to handle them. - // FIXME(nagisa): due to https://bugs.llvm.org/show_bug.cgi?id=33303 we canonicalize by - // multiplying by 1.0. Should switch to the `canonicalize` when it works. - (if x < y || y != y { x } else { y }) * 1.0 -} - -/// Returns the minimum of two `f64` values. -#[cfg(bootstrap)] -pub fn minnumf64(x: f64, y: f64) -> f64 { - // Identical to the `f32` case. - (if x < y || y != y { x } else { y }) * 1.0 -} - -/// Returns the maximum of two `f32` values. -#[cfg(bootstrap)] -pub fn maxnumf32(x: f32, y: f32) -> f32 { - // IEEE754 says: maxNum(x, y) is the canonicalized number y if x < y, x if y < x, the - // canonicalized number if one operand is a number and the other a quiet NaN. Otherwise it - // is either x or y, canonicalized (this means results might differ among implementations). - // When either x or y is a signaling NaN, then the result is according to 6.2. - // - // Since we do not support sNaN in Rust yet, we do not need to handle them. - // FIXME(nagisa): due to https://bugs.llvm.org/show_bug.cgi?id=33303 we canonicalize by - // multiplying by 1.0. Should switch to the `canonicalize` when it works. - (if x < y || x != x { y } else { x }) * 1.0 -} - -/// Returns the maximum of two `f64` values. -#[cfg(bootstrap)] -pub fn maxnumf64(x: f64, y: f64) -> f64 { - // Identical to the `f32` case. - (if x < y || x != x { y } else { x }) * 1.0 -} - -/// For bootstrapping, implement unchecked_sub as just wrapping_sub. -#[cfg(bootstrap)] -pub unsafe fn unchecked_sub(x: T, y: T) -> T { - sub_with_overflow(x, y).0 -} diff --git a/src/libcore/lib.rs b/src/libcore/lib.rs index d2d08a075b9..398b929b206 100644 --- a/src/libcore/lib.rs +++ b/src/libcore/lib.rs @@ -99,7 +99,7 @@ #![feature(staged_api)] #![feature(std_internals)] #![feature(stmt_expr_attributes)] -#![cfg_attr(not(bootstrap), feature(transparent_unions))] +#![feature(transparent_unions)] #![feature(unboxed_closures)] #![feature(unsized_locals)] #![feature(untagged_unions)] diff --git a/src/libcore/mem/maybe_uninit.rs b/src/libcore/mem/maybe_uninit.rs index 28e1e22ba7f..407691662d1 100644 --- a/src/libcore/mem/maybe_uninit.rs +++ b/src/libcore/mem/maybe_uninit.rs @@ -207,7 +207,7 @@ use crate::mem::ManuallyDrop; #[allow(missing_debug_implementations)] #[stable(feature = "maybe_uninit", since = "1.36.0")] #[derive(Copy)] -#[cfg_attr(not(bootstrap), repr(transparent))] +#[repr(transparent)] pub union MaybeUninit { uninit: (), value: ManuallyDrop, diff --git a/src/libcore/num/mod.rs b/src/libcore/num/mod.rs index d70f5567011..72552c5a0b0 100644 --- a/src/libcore/num/mod.rs +++ b/src/libcore/num/mod.rs @@ -50,7 +50,7 @@ assert_eq!(size_of::>(), size_of::<", s #[derive(Copy, Clone, Eq, PartialEq, Ord, PartialOrd, Hash)] #[repr(transparent)] #[rustc_layout_scalar_valid_range_start(1)] - #[cfg_attr(not(bootstrap), rustc_nonnull_optimization_guaranteed)] + #[rustc_nonnull_optimization_guaranteed] pub struct $Ty($Int); } diff --git a/src/libcore/ptr/non_null.rs b/src/libcore/ptr/non_null.rs index 46dde7c1da5..ad3d1ce396a 100644 --- a/src/libcore/ptr/non_null.rs +++ b/src/libcore/ptr/non_null.rs @@ -38,7 +38,7 @@ use crate::cmp::Ordering; #[stable(feature = "nonnull", since = "1.25.0")] #[repr(transparent)] #[rustc_layout_scalar_valid_range_start(1)] -#[cfg_attr(not(bootstrap), rustc_nonnull_optimization_guaranteed)] +#[rustc_nonnull_optimization_guaranteed] pub struct NonNull { pointer: *const T, } diff --git a/src/librustc_data_structures/macros.rs b/src/librustc_data_structures/macros.rs index 6e7a8e98853..3f75523a815 100644 --- a/src/librustc_data_structures/macros.rs +++ b/src/librustc_data_structures/macros.rs @@ -1,7 +1,6 @@ /// A simple static assertion macro. #[macro_export] -#[cfg_attr(bootstrap, allow_internal_unstable(type_ascription, underscore_const_names))] -#[cfg_attr(not(bootstrap), allow_internal_unstable(type_ascription))] +#[allow_internal_unstable(type_ascription)] macro_rules! static_assert { ($test:expr) => { // Use the bool to access an array such that if the bool is false, the access @@ -13,7 +12,6 @@ macro_rules! static_assert { /// Type size assertion. The first argument is a type and the second argument is its expected size. #[macro_export] -#[cfg_attr(bootstrap, allow_internal_unstable(underscore_const_names))] macro_rules! static_assert_size { ($ty:ty, $size:expr) => { const _: [(); $size] = [(); ::std::mem::size_of::<$ty>()]; diff --git a/src/librustc_resolve/lib.rs b/src/librustc_resolve/lib.rs index 05247600a4d..ce5a6b854ea 100644 --- a/src/librustc_resolve/lib.rs +++ b/src/librustc_resolve/lib.rs @@ -7,7 +7,6 @@ #![feature(mem_take)] #![feature(nll)] #![feature(rustc_diagnostic_macros)] -#![cfg_attr(bootstrap, feature(type_alias_enum_variants))] #![recursion_limit="256"] diff --git a/src/libsyntax/tokenstream.rs b/src/libsyntax/tokenstream.rs index cd906bb282b..b32049b1da8 100644 --- a/src/libsyntax/tokenstream.rs +++ b/src/libsyntax/tokenstream.rs @@ -59,17 +59,6 @@ where TokenStream: Send + Sync, {} -// These are safe since we ensure that they hold for all fields in the `_dummy` function. -// -// These impls are only here because the compiler takes forever to compute the Send and Sync -// bounds without them. -// FIXME: Remove these impls when the compiler can compute the bounds quickly again. -// See https://github.com/rust-lang/rust/issues/60846 -#[cfg(all(bootstrap, parallel_compiler))] -unsafe impl Send for TokenTree {} -#[cfg(all(bootstrap, parallel_compiler))] -unsafe impl Sync for TokenTree {} - impl TokenTree { /// Use this token tree as a matcher to parse given tts. pub fn parse(cx: &base::ExtCtxt<'_>, mtch: &[quoted::TokenTree], tts: TokenStream) diff --git a/src/libunwind/build.rs b/src/libunwind/build.rs index e92c68f5b0c..20280aa3c41 100644 --- a/src/libunwind/build.rs +++ b/src/libunwind/build.rs @@ -4,13 +4,11 @@ fn main() { println!("cargo:rerun-if-changed=build.rs"); let target = env::var("TARGET").expect("TARGET was not set"); - // FIXME: the not(bootstrap) part is needed because of the issue addressed by #62286, - // and could be removed once that change is in beta. - if cfg!(all(not(bootstrap), feature = "llvm-libunwind")) && + if cfg!(feature = "llvm-libunwind") && (target.contains("linux") || target.contains("fuchsia")) { // Build the unwinding from libunwind C/C++ source code. - #[cfg(all(not(bootstrap), feature = "llvm-libunwind"))] + #[cfg(feature = "llvm-libunwind")] llvm_libunwind::compile(); } else if target.contains("linux") { if target.contains("musl") { @@ -44,7 +42,7 @@ fn main() { } } -#[cfg(all(not(bootstrap), feature = "llvm-libunwind"))] +#[cfg(feature = "llvm-libunwind")] mod llvm_libunwind { use std::env; use std::path::Path; diff --git a/src/libunwind/libunwind.rs b/src/libunwind/libunwind.rs index 7e640897af7..41adc0a4153 100644 --- a/src/libunwind/libunwind.rs +++ b/src/libunwind/libunwind.rs @@ -67,7 +67,7 @@ pub enum _Unwind_Context {} pub type _Unwind_Exception_Cleanup_Fn = extern "C" fn(unwind_code: _Unwind_Reason_Code, exception: *mut _Unwind_Exception); -#[cfg_attr(all(not(bootstrap), feature = "llvm-libunwind"), +#[cfg_attr(feature = "llvm-libunwind", link(name = "unwind", kind = "static"))] extern "C" { #[unwind(allowed)] @@ -93,7 +93,7 @@ if #[cfg(all(any(target_os = "ios", target_os = "netbsd", not(target_arch = "arm } pub use _Unwind_Action::*; - #[cfg_attr(all(not(bootstrap), feature = "llvm-libunwind"), + #[cfg_attr(feature = "llvm-libunwind", link(name = "unwind", kind = "static"))] extern "C" { pub fn _Unwind_GetGR(ctx: *mut _Unwind_Context, reg_index: c_int) -> _Unwind_Word; @@ -148,7 +148,7 @@ if #[cfg(all(any(target_os = "ios", target_os = "netbsd", not(target_arch = "arm pub const UNWIND_POINTER_REG: c_int = 12; pub const UNWIND_IP_REG: c_int = 15; - #[cfg_attr(all(not(bootstrap), feature = "llvm-libunwind"), + #[cfg_attr(feature = "llvm-libunwind", link(name = "unwind", kind = "static"))] extern "C" { fn _Unwind_VRS_Get(ctx: *mut _Unwind_Context, @@ -212,7 +212,7 @@ if #[cfg(all(any(target_os = "ios", target_os = "netbsd", not(target_arch = "arm cfg_if::cfg_if! { if #[cfg(not(all(target_os = "ios", target_arch = "arm")))] { // Not 32-bit iOS - #[cfg_attr(all(not(bootstrap), feature = "llvm-libunwind"), + #[cfg_attr(feature = "llvm-libunwind", link(name = "unwind", kind = "static"))] extern "C" { #[unwind(allowed)] @@ -223,7 +223,7 @@ if #[cfg(not(all(target_os = "ios", target_arch = "arm")))] { } } else { // 32-bit iOS uses SjLj and does not provide _Unwind_Backtrace() - #[cfg_attr(all(not(bootstrap), feature = "llvm-libunwind"), + #[cfg_attr(feature = "llvm-libunwind", link(name = "unwind", kind = "static"))] extern "C" { #[unwind(allowed)] diff --git a/src/stage0.txt b/src/stage0.txt index d928d0888a0..9b70a404582 100644 --- a/src/stage0.txt +++ b/src/stage0.txt @@ -12,7 +12,7 @@ # source tarball for a stable release you'll likely see `1.x.0` for rustc and # `0.x.0` for Cargo where they were released on `date`. -date: 2019-05-23 +date: 2019-07-04 rustc: beta cargo: beta From 007d87f1719e2fcf2ff36aef8b6dc866fa276386 Mon Sep 17 00:00:00 2001 From: Mark Rousskov Date: Thu, 4 Jul 2019 11:24:56 -0400 Subject: [PATCH 2/2] Permit use of mem::uninitialized via allow(deprecated) --- src/librustc_codegen_llvm/common.rs | 1 + src/libstd/io/util.rs | 1 + src/libstd/sys/cloudabi/mod.rs | 2 ++ src/libstd/sys/sgx/mod.rs | 2 ++ src/libterm/win.rs | 1 + .../run-make-fulldeps/sanitizer-memory/uninit.rs | 1 + .../for-loop-while/for-loop-has-unit-body.rs | 1 + src/test/run-pass/issues/issue-58212.rs | 1 + src/test/run-pass/panic-uninitialized-zeroed.rs | 1 + src/test/run-pass/stack-probes.rs | 1 + .../enum-non-c-like-repr-c-and-int.rs | 1 + .../structs-enums/enum-non-c-like-repr-c.rs | 1 + .../structs-enums/enum-non-c-like-repr-int.rs | 1 + src/test/run-pass/uninit-empty-types.rs | 1 + src/test/rustdoc/issue-52873.rs | 1 + src/test/ui/const-generics/issue-61422.rs | 1 + src/test/ui/issues/issue-48131.rs | 1 + src/test/ui/issues/issue-48131.stderr | 4 ++-- .../uninhabited-matches-feature-gated.rs | 2 ++ .../uninhabited-matches-feature-gated.stderr | 14 +++++++------- 20 files changed, 30 insertions(+), 9 deletions(-) diff --git a/src/librustc_codegen_llvm/common.rs b/src/librustc_codegen_llvm/common.rs index f21f203fcc9..9fdc93c3ff0 100644 --- a/src/librustc_codegen_llvm/common.rs +++ b/src/librustc_codegen_llvm/common.rs @@ -170,6 +170,7 @@ impl CodegenCx<'ll, 'tcx> { pub fn const_get_real(&self, v: &'ll Value) -> Option<(f64, bool)> { unsafe { if self.is_const_real(v) { + #[allow(deprecated)] let mut loses_info: llvm::Bool = ::std::mem::uninitialized(); let r = llvm::LLVMConstRealGetDouble(v, &mut loses_info); let loses_info = if loses_info == 1 { true } else { false }; diff --git a/src/libstd/io/util.rs b/src/libstd/io/util.rs index 7c4eae6512d..2bfd3e4ad20 100644 --- a/src/libstd/io/util.rs +++ b/src/libstd/io/util.rs @@ -44,6 +44,7 @@ pub fn copy(reader: &mut R, writer: &mut W) -> io::Result< where R: Read, W: Write { let mut buf = unsafe { + #[allow(deprecated)] let mut buf: [u8; super::DEFAULT_BUF_SIZE] = mem::uninitialized(); reader.initializer().initialize(&mut buf); buf diff --git a/src/libstd/sys/cloudabi/mod.rs b/src/libstd/sys/cloudabi/mod.rs index c3b8bbd0426..3fef7552259 100644 --- a/src/libstd/sys/cloudabi/mod.rs +++ b/src/libstd/sys/cloudabi/mod.rs @@ -1,3 +1,5 @@ +#![allow(deprecated)] // mem::uninitialized + use crate::io::ErrorKind; use crate::mem; diff --git a/src/libstd/sys/sgx/mod.rs b/src/libstd/sys/sgx/mod.rs index 01f5536ed7a..3bf9ecf4080 100644 --- a/src/libstd/sys/sgx/mod.rs +++ b/src/libstd/sys/sgx/mod.rs @@ -3,6 +3,8 @@ //! This module contains the facade (aka platform-specific) implementations of //! OS level functionality for Fortanix SGX. +#![allow(deprecated)] + use crate::io::ErrorKind; use crate::os::raw::c_char; use crate::sync::atomic::{AtomicBool, Ordering}; diff --git a/src/libterm/win.rs b/src/libterm/win.rs index 6d42b01337e..14ea68d3788 100644 --- a/src/libterm/win.rs +++ b/src/libterm/win.rs @@ -108,6 +108,7 @@ impl WinConsole { let fg; let bg; unsafe { + #[allow(deprecated)] let mut buffer_info = ::std::mem::uninitialized(); if GetConsoleScreenBufferInfo(GetStdHandle(-11i32 as DWORD), &mut buffer_info) != 0 { fg = bits_to_color(buffer_info.wAttributes); diff --git a/src/test/run-make-fulldeps/sanitizer-memory/uninit.rs b/src/test/run-make-fulldeps/sanitizer-memory/uninit.rs index 163e2c5a462..cb857e3bc38 100644 --- a/src/test/run-make-fulldeps/sanitizer-memory/uninit.rs +++ b/src/test/run-make-fulldeps/sanitizer-memory/uninit.rs @@ -1,6 +1,7 @@ use std::mem; fn main() { + #[allow(deprecated)] let xs: [u8; 4] = unsafe { mem::uninitialized() }; let y = xs[0] + xs[1]; } diff --git a/src/test/run-pass/for-loop-while/for-loop-has-unit-body.rs b/src/test/run-pass/for-loop-while/for-loop-has-unit-body.rs index 009c59f2fa4..38c34d2dc2e 100644 --- a/src/test/run-pass/for-loop-while/for-loop-has-unit-body.rs +++ b/src/test/run-pass/for-loop-while/for-loop-has-unit-body.rs @@ -2,6 +2,7 @@ fn main() { // Check that the tail statement in the body unifies with something for _ in 0..3 { + #[allow(deprecated)] unsafe { std::mem::uninitialized() } } diff --git a/src/test/run-pass/issues/issue-58212.rs b/src/test/run-pass/issues/issue-58212.rs index 76437630309..d4ce6496cae 100644 --- a/src/test/run-pass/issues/issue-58212.rs +++ b/src/test/run-pass/issues/issue-58212.rs @@ -4,6 +4,7 @@ trait FromUnchecked { impl FromUnchecked for [u8; 1] { unsafe fn from_unchecked() { + #[allow(deprecated)] let mut array: Self = std::mem::uninitialized(); let _ptr = &mut array as *mut [u8] as *mut u8; } diff --git a/src/test/run-pass/panic-uninitialized-zeroed.rs b/src/test/run-pass/panic-uninitialized-zeroed.rs index 4ca4b407bd4..5026ad1ccd4 100644 --- a/src/test/run-pass/panic-uninitialized-zeroed.rs +++ b/src/test/run-pass/panic-uninitialized-zeroed.rs @@ -3,6 +3,7 @@ // in a runtime panic. #![feature(never_type)] +#![allow(deprecated)] use std::{mem, panic}; diff --git a/src/test/run-pass/stack-probes.rs b/src/test/run-pass/stack-probes.rs index 92a0cc3a07b..773d0ace90e 100644 --- a/src/test/run-pass/stack-probes.rs +++ b/src/test/run-pass/stack-probes.rs @@ -49,6 +49,7 @@ fn main() { #[allow(unconditional_recursion)] fn recurse(array: &[u64]) { unsafe { black_box(array.as_ptr() as u64); } + #[allow(deprecated)] let local: [_; 1024] = unsafe { mem::uninitialized() }; recurse(&local); } diff --git a/src/test/run-pass/structs-enums/enum-non-c-like-repr-c-and-int.rs b/src/test/run-pass/structs-enums/enum-non-c-like-repr-c-and-int.rs index c971f567d95..78d8e5e3a5d 100644 --- a/src/test/run-pass/structs-enums/enum-non-c-like-repr-c-and-int.rs +++ b/src/test/run-pass/structs-enums/enum-non-c-like-repr-c-and-int.rs @@ -69,6 +69,7 @@ fn main() { unsafe { // This should be safe, because we don't match on it unless it's fully formed, // and it doesn't have a destructor. + #[allow(deprecated)] let mut dest: MyEnum = mem::uninitialized(); while buf.len() > 0 { match parse_my_enum(&mut dest, &mut buf) { diff --git a/src/test/run-pass/structs-enums/enum-non-c-like-repr-c.rs b/src/test/run-pass/structs-enums/enum-non-c-like-repr-c.rs index 57ccf114509..1209533efda 100644 --- a/src/test/run-pass/structs-enums/enum-non-c-like-repr-c.rs +++ b/src/test/run-pass/structs-enums/enum-non-c-like-repr-c.rs @@ -69,6 +69,7 @@ fn main() { unsafe { // This should be safe, because we don't match on it unless it's fully formed, // and it doesn't have a destructor. + #[allow(deprecated)] let mut dest: MyEnum = mem::uninitialized(); while buf.len() > 0 { match parse_my_enum(&mut dest, &mut buf) { diff --git a/src/test/run-pass/structs-enums/enum-non-c-like-repr-int.rs b/src/test/run-pass/structs-enums/enum-non-c-like-repr-int.rs index d297c895da5..5dd9c1863d6 100644 --- a/src/test/run-pass/structs-enums/enum-non-c-like-repr-int.rs +++ b/src/test/run-pass/structs-enums/enum-non-c-like-repr-int.rs @@ -65,6 +65,7 @@ fn main() { unsafe { // This should be safe, because we don't match on it unless it's fully formed, // and it doesn't have a destructor. + #[allow(deprecated)] let mut dest: MyEnum = mem::uninitialized(); while buf.len() > 0 { match parse_my_enum(&mut dest, &mut buf) { diff --git a/src/test/run-pass/uninit-empty-types.rs b/src/test/run-pass/uninit-empty-types.rs index b59971b3498..4bc247a3dca 100644 --- a/src/test/run-pass/uninit-empty-types.rs +++ b/src/test/run-pass/uninit-empty-types.rs @@ -7,6 +7,7 @@ use std::mem; #[derive(Clone)] struct Foo; +#[allow(deprecated)] pub fn main() { unsafe { let _x: Foo = mem::uninitialized(); diff --git a/src/test/rustdoc/issue-52873.rs b/src/test/rustdoc/issue-52873.rs index 9138dd50def..653c004c04b 100644 --- a/src/test/rustdoc/issue-52873.rs +++ b/src/test/rustdoc/issue-52873.rs @@ -105,6 +105,7 @@ impl Add for UInt { impl Add for UTerm { type Output = U; fn add(self, _: U) -> Self::Output { + #[allow(deprecated)] unsafe { ::std::mem::uninitialized() } } } diff --git a/src/test/ui/const-generics/issue-61422.rs b/src/test/ui/const-generics/issue-61422.rs index 3ccf38e5619..68e5a52e0ac 100644 --- a/src/test/ui/const-generics/issue-61422.rs +++ b/src/test/ui/const-generics/issue-61422.rs @@ -7,6 +7,7 @@ use std::mem; fn foo() { let arr: [u8; SIZE] = unsafe { + #[allow(deprecated)] let mut array: [u8; SIZE] = mem::uninitialized(); array }; diff --git a/src/test/ui/issues/issue-48131.rs b/src/test/ui/issues/issue-48131.rs index b3cc350acf5..c8540729352 100644 --- a/src/test/ui/issues/issue-48131.rs +++ b/src/test/ui/issues/issue-48131.rs @@ -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() { diff --git a/src/test/ui/issues/issue-48131.stderr b/src/test/ui/issues/issue-48131.stderr index adc36e266c2..6df065b9807 100644 --- a/src/test/ui/issues/issue-48131.stderr +++ b/src/test/ui/issues/issue-48131.stderr @@ -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 diff --git a/src/test/ui/uninhabited/uninhabited-matches-feature-gated.rs b/src/test/ui/uninhabited/uninhabited-matches-feature-gated.rs index 38a52d5860d..a5360fa13c4 100644 --- a/src/test/ui/uninhabited/uninhabited-matches-feature-gated.rs +++ b/src/test/ui/uninhabited/uninhabited-matches-feature-gated.rs @@ -1,3 +1,5 @@ +#![allow(deprecated)] + enum Void {} fn main() { diff --git a/src/test/ui/uninhabited/uninhabited-matches-feature-gated.stderr b/src/test/ui/uninhabited/uninhabited-matches-feature-gated.stderr index de7a9635770..25519ab2d6a 100644 --- a/src/test/ui/uninhabited/uninhabited-matches-feature-gated.stderr +++ b/src/test/ui/uninhabited/uninhabited-matches-feature-gated.stderr @@ -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