diff --git a/src/bootstrap/channel.rs b/src/bootstrap/channel.rs index be2b0f36d14a7..f9d3b454246b1 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.44.0"; +pub const CFG_RELEASE_NUM: &str = "1.45.0"; pub struct GitInfo { inner: Option, diff --git a/src/liballoc/lib.rs b/src/liballoc/lib.rs index a2071844d5dac..f422c3f66e147 100644 --- a/src/liballoc/lib.rs +++ b/src/liballoc/lib.rs @@ -99,7 +99,7 @@ #![feature(internal_uninit_const)] #![feature(lang_items)] #![feature(libc)] -#![cfg_attr(not(bootstrap), feature(negative_impls))] +#![feature(negative_impls)] #![feature(new_uninit)] #![feature(nll)] #![feature(optin_builtin_traits)] diff --git a/src/liballoc/rc.rs b/src/liballoc/rc.rs index fb9f5faa018a4..8144fe0128ee8 100644 --- a/src/liballoc/rc.rs +++ b/src/liballoc/rc.rs @@ -279,7 +279,6 @@ struct RcBox { /// type `T`. /// /// [get_mut]: #method.get_mut -#[cfg_attr(all(bootstrap, not(test)), lang = "rc")] #[cfg_attr(not(test), rustc_diagnostic_item = "Rc")] #[stable(feature = "rust1", since = "1.0.0")] pub struct Rc { diff --git a/src/liballoc/sync.rs b/src/liballoc/sync.rs index cde412bee78d9..adce23c42c0e8 100644 --- a/src/liballoc/sync.rs +++ b/src/liballoc/sync.rs @@ -207,7 +207,6 @@ macro_rules! acquire { /// counting in general. /// /// [rc_examples]: ../../std/rc/index.html#examples -#[cfg_attr(all(bootstrap, not(test)), lang = "arc")] #[cfg_attr(not(test), rustc_diagnostic_item = "Arc")] #[stable(feature = "rust1", since = "1.0.0")] pub struct Arc { diff --git a/src/libcore/clone.rs b/src/libcore/clone.rs index 6165941eb3dae..7784ec687ea9a 100644 --- a/src/libcore/clone.rs +++ b/src/libcore/clone.rs @@ -231,6 +231,5 @@ mod impls { /// Shared references can be cloned, but mutable references *cannot*! #[stable(feature = "rust1", since = "1.0.0")] - #[cfg(not(bootstrap))] impl !Clone for &mut T {} } diff --git a/src/libcore/convert/num.rs b/src/libcore/convert/num.rs index 66ae760fc1f79..6dd0522f7f610 100644 --- a/src/libcore/convert/num.rs +++ b/src/libcore/convert/num.rs @@ -28,14 +28,7 @@ macro_rules! impl_float_to_int { #[doc(hidden)] #[inline] unsafe fn to_int_unchecked(self) -> $Int { - #[cfg(bootstrap)] - { - crate::intrinsics::float_to_int_approx_unchecked(self) - } - #[cfg(not(bootstrap))] - { - crate::intrinsics::float_to_int_unchecked(self) - } + crate::intrinsics::float_to_int_unchecked(self) } } )+ diff --git a/src/libcore/future/mod.rs b/src/libcore/future/mod.rs index a6b769147d068..e7f681c2e9450 100644 --- a/src/libcore/future/mod.rs +++ b/src/libcore/future/mod.rs @@ -2,7 +2,6 @@ //! Asynchronous values. -#[cfg(not(bootstrap))] use crate::{ ops::{Generator, GeneratorState}, pin::Pin, @@ -24,16 +23,13 @@ pub use self::future::Future; /// It also simplifies the HIR lowering of `.await`. #[doc(hidden)] #[unstable(feature = "gen_future", issue = "50547")] -#[cfg(not(bootstrap))] #[derive(Debug, Copy, Clone)] pub struct ResumeTy(NonNull>); #[unstable(feature = "gen_future", issue = "50547")] -#[cfg(not(bootstrap))] unsafe impl Send for ResumeTy {} #[unstable(feature = "gen_future", issue = "50547")] -#[cfg(not(bootstrap))] unsafe impl Sync for ResumeTy {} /// Wrap a generator in a future. @@ -43,7 +39,6 @@ unsafe impl Sync for ResumeTy {} // This is `const` to avoid extra errors after we recover from `const async fn` #[doc(hidden)] #[unstable(feature = "gen_future", issue = "50547")] -#[cfg(not(bootstrap))] #[inline] pub const fn from_generator(gen: T) -> impl Future where @@ -75,7 +70,6 @@ where #[doc(hidden)] #[unstable(feature = "gen_future", issue = "50547")] -#[cfg(not(bootstrap))] #[inline] pub unsafe fn get_context<'a, 'b>(cx: ResumeTy) -> &'a mut Context<'b> { &mut *cx.0.as_ptr().cast() diff --git a/src/libcore/intrinsics.rs b/src/libcore/intrinsics.rs index 75c7313089112..45633dc3ca51f 100644 --- a/src/libcore/intrinsics.rs +++ b/src/libcore/intrinsics.rs @@ -980,22 +980,7 @@ extern "rust-intrinsic" { /// /// The stabilized version of this intrinsic is /// [`std::mem::size_of_val`](../../std/mem/fn.size_of_val.html). - #[cfg(bootstrap)] - pub fn size_of_val(_: &T) -> usize; - /// The minimum alignment of the type of the value that `val` points to. - /// - /// The stabilized version of this intrinsic is - /// [`std::mem::min_align_of_val`](../../std/mem/fn.min_align_of_val.html). - #[cfg(bootstrap)] - pub fn min_align_of_val(_: &T) -> usize; - - /// The size of the referenced value in bytes. - /// - /// The stabilized version of this intrinsic is - /// [`std::mem::size_of_val`](../../std/mem/fn.size_of_val.html). - #[cfg(not(bootstrap))] pub fn size_of_val(_: *const T) -> usize; - #[cfg(not(bootstrap))] pub fn min_align_of_val(_: *const T) -> usize; /// Gets a static string slice containing the name of a type. @@ -1016,22 +1001,14 @@ extern "rust-intrinsic" { /// A guard for unsafe functions that cannot ever be executed if `T` is uninhabited: /// This will statically either panic, or do nothing. - #[cfg(bootstrap)] - pub fn panic_if_uninhabited(); - - /// A guard for unsafe functions that cannot ever be executed if `T` is uninhabited: - /// This will statically either panic, or do nothing. - #[cfg(not(bootstrap))] pub fn assert_inhabited(); /// A guard for unsafe functions that cannot ever be executed if `T` does not permit /// zero-initialization: This will statically either panic, or do nothing. - #[cfg(not(bootstrap))] pub fn assert_zero_valid(); /// A guard for unsafe functions that cannot ever be executed if `T` has invalid /// bit patterns: This will statically either panic, or do nothing. - #[cfg(not(bootstrap))] pub fn assert_uninit_valid(); /// Gets a reference to a static `Location` indicating where it was called. @@ -1597,17 +1574,10 @@ extern "rust-intrinsic" { /// May assume inputs are finite. pub fn frem_fast(a: T, b: T) -> T; - /// Convert with LLVM’s fptoui/fptosi, which may return undef for values out of range - /// () - /// This is under stabilization at - #[cfg(bootstrap)] - pub fn float_to_int_approx_unchecked(value: Float) -> Int; - /// Convert with LLVM’s fptoui/fptosi, which may return undef for values out of range /// () /// /// Stabilized as `f32::to_int_unchecked` and `f64::to_int_unchecked`. - #[cfg(not(bootstrap))] pub fn float_to_int_unchecked(value: Float) -> Int; /// Returns the number of bits set in an integer type `T` @@ -1877,10 +1847,7 @@ extern "rust-intrinsic" { /// takes the data pointer and a pointer to the target-specific exception /// object that was caught. For more information see the compiler's /// source as well as std's catch implementation. - #[cfg(not(bootstrap))] pub fn r#try(try_fn: fn(*mut u8), data: *mut u8, catch_fn: fn(*mut u8, *mut u8)) -> i32; - #[cfg(bootstrap)] - pub fn r#try(f: fn(*mut u8), data: *mut u8, local_ptr: *mut u8) -> i32; /// Emits a `!nontemporal` store according to LLVM (see their docs). /// Probably will never become stable. diff --git a/src/libcore/iter/range.rs b/src/libcore/iter/range.rs index 37369289c512e..bb68184c8dd77 100644 --- a/src/libcore/iter/range.rs +++ b/src/libcore/iter/range.rs @@ -70,7 +70,7 @@ macro_rules! step_identical_methods { fn sub_one(&self) -> Self { Sub::sub(*self, 1) } - } + }; } macro_rules! step_impl_unsigned { diff --git a/src/libcore/lib.rs b/src/libcore/lib.rs index 1c7bce3fac583..3b7929f00168a 100644 --- a/src/libcore/lib.rs +++ b/src/libcore/lib.rs @@ -99,7 +99,7 @@ #![feature(lang_items)] #![feature(link_llvm_intrinsics)] #![feature(llvm_asm)] -#![cfg_attr(not(bootstrap), feature(negative_impls))] +#![feature(negative_impls)] #![feature(never_type)] #![feature(nll)] #![feature(exhaustive_patterns)] diff --git a/src/libcore/macros/mod.rs b/src/libcore/macros/mod.rs index 73404a73e3d00..85d848f54fbb7 100644 --- a/src/libcore/macros/mod.rs +++ b/src/libcore/macros/mod.rs @@ -1,27 +1,3 @@ -#[cfg(bootstrap)] -#[doc(include = "panic.md")] -#[macro_export] -#[allow_internal_unstable(core_panic, track_caller)] -#[stable(feature = "core", since = "1.6.0")] -macro_rules! panic { - () => ( - $crate::panic!("explicit panic") - ); - ($msg:expr) => ( - $crate::panicking::panic($msg) - ); - ($msg:expr,) => ( - $crate::panic!($msg) - ); - ($fmt:expr, $($arg:tt)+) => ( - $crate::panicking::panic_fmt( - $crate::format_args!($fmt, $($arg)+), - $crate::panic::Location::caller(), - ) - ); -} - -#[cfg(not(bootstrap))] #[doc(include = "panic.md")] #[macro_export] #[allow_internal_unstable(core_panic, track_caller)] @@ -1341,25 +1317,6 @@ pub(crate) mod builtin { /// Read the [unstable book] for the usage. /// /// [unstable book]: ../unstable-book/library-features/asm.html - #[cfg(bootstrap)] - #[unstable( - feature = "llvm_asm", - issue = "70173", - reason = "inline assembly is not stable enough for use and is subject to change" - )] - #[macro_export] - #[allow_internal_unstable(asm)] - macro_rules! llvm_asm { - // Redirect to asm! for stage0 - ($($arg:tt)*) => { $crate::asm!($($arg)*) } - } - - /// Inline assembly. - /// - /// Read the [unstable book] for the usage. - /// - /// [unstable book]: ../unstable-book/library-features/asm.html - #[cfg(not(bootstrap))] #[unstable( feature = "llvm_asm", issue = "70173", @@ -1460,7 +1417,6 @@ pub(crate) mod builtin { } /// Keeps the item it's applied to if the passed path is accessible, and removes it otherwise. - #[cfg(not(bootstrap))] #[unstable( feature = "cfg_accessible", issue = "64797", diff --git a/src/libcore/marker.rs b/src/libcore/marker.rs index 549933ceeb645..09a8b417e6e22 100644 --- a/src/libcore/marker.rs +++ b/src/libcore/marker.rs @@ -90,7 +90,7 @@ impl !Send for *mut T {} ch19-04-advanced-types.html#dynamically-sized-types-and-the-sized-trait>" )] #[fundamental] // for Default, for example, which requires that `[T]: !Default` be evaluatable -#[cfg_attr(not(bootstrap), rustc_specialization_trait)] +#[rustc_specialization_trait] pub trait Sized { // Empty. } diff --git a/src/libcore/mem/maybe_uninit.rs b/src/libcore/mem/maybe_uninit.rs index bf39d56fc115c..f7ea7eba7b16b 100644 --- a/src/libcore/mem/maybe_uninit.rs +++ b/src/libcore/mem/maybe_uninit.rs @@ -495,9 +495,6 @@ impl MaybeUninit { #[inline(always)] #[rustc_diagnostic_item = "assume_init"] pub unsafe fn assume_init(self) -> T { - #[cfg(bootstrap)] - intrinsics::panic_if_uninhabited::(); - #[cfg(not(bootstrap))] intrinsics::assert_inhabited::(); ManuallyDrop::into_inner(self.value) } @@ -562,9 +559,6 @@ impl MaybeUninit { #[unstable(feature = "maybe_uninit_extra", issue = "63567")] #[inline(always)] pub unsafe fn read(&self) -> T { - #[cfg(bootstrap)] - intrinsics::panic_if_uninhabited::(); - #[cfg(not(bootstrap))] intrinsics::assert_inhabited::(); self.as_ptr().read() } @@ -627,9 +621,6 @@ impl MaybeUninit { #[unstable(feature = "maybe_uninit_ref", issue = "63568")] #[inline(always)] pub unsafe fn get_ref(&self) -> &T { - #[cfg(bootstrap)] - intrinsics::panic_if_uninhabited::(); - #[cfg(not(bootstrap))] intrinsics::assert_inhabited::(); &*self.value } @@ -748,9 +739,6 @@ impl MaybeUninit { #[unstable(feature = "maybe_uninit_ref", issue = "63568")] #[inline(always)] pub unsafe fn get_mut(&mut self) -> &mut T { - #[cfg(bootstrap)] - intrinsics::panic_if_uninhabited::(); - #[cfg(not(bootstrap))] intrinsics::assert_inhabited::(); &mut *self.value } diff --git a/src/libcore/mem/mod.rs b/src/libcore/mem/mod.rs index 7fcfbf108144c..b1bbcaeab8def 100644 --- a/src/libcore/mem/mod.rs +++ b/src/libcore/mem/mod.rs @@ -378,7 +378,6 @@ pub fn size_of_val(val: &T) -> usize { /// assert_eq!(13, unsafe { mem::size_of_val_raw(y) }); /// ``` #[inline] -#[cfg(not(bootstrap))] #[unstable(feature = "layout_for_ptr", issue = "69835")] pub unsafe fn size_of_val_raw(val: *const T) -> usize { intrinsics::size_of_val(val) @@ -509,7 +508,6 @@ pub fn align_of_val(val: &T) -> usize { /// assert_eq!(4, unsafe { mem::align_of_val_raw(&5i32) }); /// ``` #[inline] -#[cfg(not(bootstrap))] #[unstable(feature = "layout_for_ptr", issue = "69835")] pub unsafe fn align_of_val_raw(val: *const T) -> usize { intrinsics::min_align_of_val(val) @@ -621,10 +619,7 @@ pub const fn needs_drop() -> bool { #[allow(deprecated)] #[rustc_diagnostic_item = "mem_zeroed"] pub unsafe fn zeroed() -> T { - #[cfg(not(bootstrap))] intrinsics::assert_zero_valid::(); - #[cfg(bootstrap)] - intrinsics::panic_if_uninhabited::(); MaybeUninit::zeroed().assume_init() } @@ -657,10 +652,7 @@ pub unsafe fn zeroed() -> T { #[allow(deprecated)] #[rustc_diagnostic_item = "mem_uninitialized"] pub unsafe fn uninitialized() -> T { - #[cfg(not(bootstrap))] intrinsics::assert_uninit_valid::(); - #[cfg(bootstrap)] - intrinsics::panic_if_uninhabited::(); MaybeUninit::uninit().assume_init() } diff --git a/src/libcore/ops/deref.rs b/src/libcore/ops/deref.rs index e2deeb556610c..6e96aa330ff19 100644 --- a/src/libcore/ops/deref.rs +++ b/src/libcore/ops/deref.rs @@ -81,7 +81,6 @@ impl Deref for &T { } } -#[cfg(not(bootstrap))] #[stable(feature = "rust1", since = "1.0.0")] impl !DerefMut for &T {} diff --git a/src/libcore/ops/index.rs b/src/libcore/ops/index.rs index 64dd633f75d2b..763b33606fe88 100644 --- a/src/libcore/ops/index.rs +++ b/src/libcore/ops/index.rs @@ -65,7 +65,7 @@ pub trait Index { /// Performs the indexing (`container[index]`) operation. #[stable(feature = "rust1", since = "1.0.0")] - #[cfg_attr(not(bootstrap), track_caller)] + #[track_caller] fn index(&self, index: Idx) -> &Self::Output; } @@ -167,6 +167,6 @@ see chapter in The Book : Index { /// Performs the mutable indexing (`container[index]`) operation. #[stable(feature = "rust1", since = "1.0.0")] - #[cfg_attr(not(bootstrap), track_caller)] + #[track_caller] fn index_mut(&mut self, index: Idx) -> &mut Self::Output; } diff --git a/src/libcore/panicking.rs b/src/libcore/panicking.rs index 1e4209fd26be3..94ea9b78828db 100644 --- a/src/libcore/panicking.rs +++ b/src/libcore/panicking.rs @@ -49,13 +49,9 @@ pub fn panic(expr: &str) -> ! { // truncation and padding (even though none is used here). Using // Arguments::new_v1 may allow the compiler to omit Formatter::pad from the // output binary, saving up to a few kilobytes. - #[cfg(not(bootstrap))] panic_fmt(fmt::Arguments::new_v1(&[expr], &[])); - #[cfg(bootstrap)] - panic_fmt(fmt::Arguments::new_v1(&[expr], &[]), Location::caller()); } -#[cfg(not(bootstrap))] #[cold] #[cfg_attr(not(feature = "panic_immediate_abort"), inline(never))] #[track_caller] @@ -69,30 +65,12 @@ fn panic_bounds_check(index: usize, len: usize) -> ! { panic!("index out of bounds: the len is {} but the index is {}", len, index) } -// For bootstrap, we need a variant with the old argument order, and a corresponding -// `panic_fmt`. -#[cfg(bootstrap)] -#[cold] -#[cfg_attr(not(feature = "panic_immediate_abort"), inline(never))] -#[lang = "panic_bounds_check"] // needed by codegen for panic on OOB array/slice access -fn panic_bounds_check(location: &Location<'_>, index: usize, len: usize) -> ! { - if cfg!(feature = "panic_immediate_abort") { - // SAFETY: the `abort` intrinsic has no requirements to be called. - unsafe { super::intrinsics::abort() } - } - - panic_fmt( - format_args!("index out of bounds: the len is {} but the index is {}", len, index), - location, - ) -} - /// The underlying implementation of libcore's `panic!` macro when formatting is used. #[cold] #[cfg_attr(not(feature = "panic_immediate_abort"), inline(never))] #[cfg_attr(feature = "panic_immediate_abort", inline)] -#[cfg_attr(not(bootstrap), track_caller)] -pub fn panic_fmt(fmt: fmt::Arguments<'_>, #[cfg(bootstrap)] location: &Location<'_>) -> ! { +#[track_caller] +pub fn panic_fmt(fmt: fmt::Arguments<'_>) -> ! { if cfg!(feature = "panic_immediate_abort") { // SAFETY: the `abort` intrinsic has no requirements to be called. unsafe { super::intrinsics::abort() } @@ -105,9 +83,6 @@ pub fn panic_fmt(fmt: fmt::Arguments<'_>, #[cfg(bootstrap)] location: &Location< fn panic_impl(pi: &PanicInfo<'_>) -> !; } - #[cfg(bootstrap)] - let pi = PanicInfo::internal_constructor(Some(&fmt), location); - #[cfg(not(bootstrap))] let pi = PanicInfo::internal_constructor(Some(&fmt), Location::caller()); // SAFETY: `panic_impl` is defined in safe Rust code and thus is safe to call. diff --git a/src/libcore/prelude/v1.rs b/src/libcore/prelude/v1.rs index 6a51d39ab9d4e..b4fff3d67b555 100644 --- a/src/libcore/prelude/v1.rs +++ b/src/libcore/prelude/v1.rs @@ -69,7 +69,6 @@ pub use crate::macros::builtin::{ bench, global_allocator, test, test_case, RustcDecodable, RustcEncodable, }; -#[cfg(not(bootstrap))] #[unstable( feature = "cfg_accessible", issue = "64797", diff --git a/src/libcore/ptr/const_ptr.rs b/src/libcore/ptr/const_ptr.rs index 729e0b897c098..35a0852bbf545 100644 --- a/src/libcore/ptr/const_ptr.rs +++ b/src/libcore/ptr/const_ptr.rs @@ -706,7 +706,6 @@ impl *const T { } } -#[cfg(not(bootstrap))] #[lang = "const_slice_ptr"] impl *const [T] { /// Returns the length of a raw slice. diff --git a/src/libcore/ptr/mut_ptr.rs b/src/libcore/ptr/mut_ptr.rs index 3b7e83bf37fa6..dbd92ce5fcc5b 100644 --- a/src/libcore/ptr/mut_ptr.rs +++ b/src/libcore/ptr/mut_ptr.rs @@ -894,7 +894,6 @@ impl *mut T { } } -#[cfg(not(bootstrap))] #[lang = "mut_slice_ptr"] impl *mut [T] { /// Returns the length of a raw slice. diff --git a/src/libcore/slice/mod.rs b/src/libcore/slice/mod.rs index dc395bcfba5cc..7b357bb487a0a 100644 --- a/src/libcore/slice/mod.rs +++ b/src/libcore/slice/mod.rs @@ -2831,13 +2831,13 @@ pub trait SliceIndex: private_slice_index::Sealed { /// Returns a shared reference to the output at this location, panicking /// if out of bounds. #[unstable(feature = "slice_index_methods", issue = "none")] - #[cfg_attr(not(bootstrap), track_caller)] + #[track_caller] fn index(self, slice: &T) -> &Self::Output; /// Returns a mutable reference to the output at this location, panicking /// if out of bounds. #[unstable(feature = "slice_index_methods", issue = "none")] - #[cfg_attr(not(bootstrap), track_caller)] + #[track_caller] fn index_mut(self, slice: &mut T) -> &mut Self::Output; } diff --git a/src/libpanic_abort/lib.rs b/src/libpanic_abort/lib.rs index f44a875c9d0d5..fd3e11858cef6 100644 --- a/src/libpanic_abort/lib.rs +++ b/src/libpanic_abort/lib.rs @@ -106,15 +106,6 @@ pub mod personalities { 1 // `ExceptionContinueSearch` } - // Similar to above, this corresponds to the `eh_unwind_resume` lang item - // that's only used on Windows currently. - // - // Note that we don't execute landing pads, so this is never called, so it's - // body is empty. - #[rustc_std_internal_symbol] - #[cfg(all(bootstrap, target_os = "windows", target_env = "gnu"))] - pub extern "C" fn rust_eh_unwind_resume() {} - // These two are called by our startup objects on i686-pc-windows-gnu, but // they don't need to do anything so the bodies are nops. #[rustc_std_internal_symbol] diff --git a/src/libpanic_unwind/gcc.rs b/src/libpanic_unwind/gcc.rs index 1622442a5eb45..f5d83c21da068 100644 --- a/src/libpanic_unwind/gcc.rs +++ b/src/libpanic_unwind/gcc.rs @@ -311,18 +311,6 @@ unsafe fn find_eh_action( eh::find_eh_action(lsda, &eh_context, foreign_exception) } -#[cfg(all( - bootstrap, - target_os = "windows", - any(target_arch = "x86", target_arch = "x86_64"), - target_env = "gnu" -))] -#[lang = "eh_unwind_resume"] -#[unwind(allowed)] -unsafe extern "C" fn rust_eh_unwind_resume(panic_ctx: *mut u8) -> ! { - uw::_Unwind_Resume(panic_ctx as *mut uw::_Unwind_Exception); -} - // Frame unwind info registration // // Each module's image contains a frame unwind info section (usually diff --git a/src/libpanic_unwind/seh.rs b/src/libpanic_unwind/seh.rs index 9eff37f17663a..8d8276b4159ac 100644 --- a/src/libpanic_unwind/seh.rs +++ b/src/libpanic_unwind/seh.rs @@ -213,7 +213,6 @@ extern "C" { // // This is fine since the MSVC runtime uses string comparison on the type name // to match TypeDescriptors rather than pointer equality. -#[cfg_attr(bootstrap, lang = "eh_catch_typeinfo")] static mut TYPE_DESCRIPTOR: _TypeDescriptor = _TypeDescriptor { pVFTable: unsafe { &TYPE_INFO_VTABLE } as *const _ as *const _, spare: core::ptr::null_mut(), diff --git a/src/libproc_macro/lib.rs b/src/libproc_macro/lib.rs index 3cbe852de7b5a..eb7677e9345f2 100644 --- a/src/libproc_macro/lib.rs +++ b/src/libproc_macro/lib.rs @@ -24,11 +24,10 @@ #![feature(decl_macro)] #![feature(extern_types)] #![feature(in_band_lifetimes)] -#![cfg_attr(not(bootstrap), feature(negative_impls))] +#![feature(negative_impls)] #![feature(optin_builtin_traits)] #![feature(rustc_attrs)] -#![cfg_attr(bootstrap, feature(specialization))] -#![cfg_attr(not(bootstrap), feature(min_specialization))] +#![feature(min_specialization)] #![recursion_limit = "256"] #[unstable(feature = "proc_macro_internals", issue = "27812")] @@ -274,14 +273,14 @@ impl !Send for Span {} impl !Sync for Span {} macro_rules! diagnostic_method { - ($name:ident, $level:expr) => ( + ($name:ident, $level:expr) => { /// Creates a new `Diagnostic` with the given `message` at the span /// `self`. #[unstable(feature = "proc_macro_diagnostic", issue = "54140")] pub fn $name>(self, message: T) -> Diagnostic { Diagnostic::spanned(self, $level, message) } - ) + }; } impl Span { diff --git a/src/librustc_metadata/rmeta/table.rs b/src/librustc_metadata/rmeta/table.rs index 752caff754eeb..bacb5a345fca9 100644 --- a/src/librustc_metadata/rmeta/table.rs +++ b/src/librustc_metadata/rmeta/table.rs @@ -42,10 +42,7 @@ macro_rules! fixed_size_encoding_byte_len_and_defaults { // but slicing `[u8]` with `i * N..` is optimized worse, due to the // possibility of `i * N` overflowing, than indexing `[[u8; N]]`. let b = unsafe { - std::slice::from_raw_parts( - b.as_ptr() as *const [u8; BYTE_LEN], - b.len() / BYTE_LEN, - ) + std::slice::from_raw_parts(b.as_ptr() as *const [u8; BYTE_LEN], b.len() / BYTE_LEN) }; b.get(i).map(|b| FixedSizeEncoding::from_bytes(b)) } @@ -61,7 +58,7 @@ macro_rules! fixed_size_encoding_byte_len_and_defaults { }; self.write_to_bytes(&mut b[i]); } - } + }; } impl FixedSizeEncoding for u32 { diff --git a/src/librustc_span/lib.rs b/src/librustc_span/lib.rs index e8252d96350db..060ad604369fb 100644 --- a/src/librustc_span/lib.rs +++ b/src/librustc_span/lib.rs @@ -9,7 +9,7 @@ #![feature(const_if_match)] #![feature(const_fn)] #![feature(const_panic)] -#![cfg_attr(not(bootstrap), feature(negative_impls))] +#![feature(negative_impls)] #![feature(nll)] #![feature(optin_builtin_traits)] #![feature(specialization)] diff --git a/src/libserialize/json.rs b/src/libserialize/json.rs index cacc28b6e60e4..7565bdeb4096e 100644 --- a/src/libserialize/json.rs +++ b/src/libserialize/json.rs @@ -2305,7 +2305,7 @@ macro_rules! read_primitive { value => Err(ExpectedError("Number".to_owned(), value.to_string())), } } - } + }; } impl crate::Decoder for Decoder { diff --git a/src/libstd/ascii.rs b/src/libstd/ascii.rs index 41bdfea53e559..5cd2a25b11768 100644 --- a/src/libstd/ascii.rs +++ b/src/libstd/ascii.rs @@ -149,23 +149,35 @@ pub trait AsciiExt { macro_rules! delegating_ascii_methods { () => { #[inline] - fn is_ascii(&self) -> bool { self.is_ascii() } + fn is_ascii(&self) -> bool { + self.is_ascii() + } #[inline] - fn to_ascii_uppercase(&self) -> Self::Owned { self.to_ascii_uppercase() } + fn to_ascii_uppercase(&self) -> Self::Owned { + self.to_ascii_uppercase() + } #[inline] - fn to_ascii_lowercase(&self) -> Self::Owned { self.to_ascii_lowercase() } + fn to_ascii_lowercase(&self) -> Self::Owned { + self.to_ascii_lowercase() + } #[inline] - fn eq_ignore_ascii_case(&self, o: &Self) -> bool { self.eq_ignore_ascii_case(o) } + fn eq_ignore_ascii_case(&self, o: &Self) -> bool { + self.eq_ignore_ascii_case(o) + } #[inline] - fn make_ascii_uppercase(&mut self) { self.make_ascii_uppercase(); } + fn make_ascii_uppercase(&mut self) { + self.make_ascii_uppercase(); + } #[inline] - fn make_ascii_lowercase(&mut self) { self.make_ascii_lowercase(); } - } + fn make_ascii_lowercase(&mut self) { + self.make_ascii_lowercase(); + } + }; } #[stable(feature = "rust1", since = "1.0.0")] diff --git a/src/libstd/future.rs b/src/libstd/future.rs index c0675eeba98da..e2092cfefa369 100644 --- a/src/libstd/future.rs +++ b/src/libstd/future.rs @@ -1,111 +1,5 @@ //! Asynchronous values. -#[cfg(bootstrap)] -use core::{ - cell::Cell, - marker::Unpin, - ops::{Drop, Generator, GeneratorState}, - pin::Pin, - ptr::NonNull, - task::{Context, Poll}, -}; - #[doc(inline)] #[stable(feature = "futures_api", since = "1.36.0")] pub use core::future::*; - -/// Wrap a generator in a future. -/// -/// This function returns a `GenFuture` underneath, but hides it in `impl Trait` to give -/// better error messages (`impl Future` rather than `GenFuture<[closure.....]>`). -// This is `const` to avoid extra errors after we recover from `const async fn` -#[cfg(bootstrap)] -#[doc(hidden)] -#[unstable(feature = "gen_future", issue = "50547")] -pub const fn from_generator>(x: T) -> impl Future { - GenFuture(x) -} - -/// A wrapper around generators used to implement `Future` for `async`/`await` code. -#[cfg(bootstrap)] -#[doc(hidden)] -#[unstable(feature = "gen_future", issue = "50547")] -#[derive(Copy, Clone, Debug, Eq, PartialEq, Ord, PartialOrd, Hash)] -struct GenFuture>(T); - -// We rely on the fact that async/await futures are immovable in order to create -// self-referential borrows in the underlying generator. -#[cfg(bootstrap)] -impl> !Unpin for GenFuture {} - -#[cfg(bootstrap)] -#[doc(hidden)] -#[unstable(feature = "gen_future", issue = "50547")] -impl> Future for GenFuture { - type Output = T::Return; - fn poll(self: Pin<&mut Self>, cx: &mut Context<'_>) -> Poll { - // Safe because we're !Unpin + !Drop mapping to a ?Unpin value - let gen = unsafe { Pin::map_unchecked_mut(self, |s| &mut s.0) }; - let _guard = unsafe { set_task_context(cx) }; - match gen.resume(()) { - GeneratorState::Yielded(()) => Poll::Pending, - GeneratorState::Complete(x) => Poll::Ready(x), - } - } -} - -#[cfg(bootstrap)] -thread_local! { - static TLS_CX: Cell>>> = Cell::new(None); -} - -#[cfg(bootstrap)] -struct SetOnDrop(Option>>); - -#[cfg(bootstrap)] -impl Drop for SetOnDrop { - fn drop(&mut self) { - TLS_CX.with(|tls_cx| { - tls_cx.set(self.0.take()); - }); - } -} - -// Safety: the returned guard must drop before `cx` is dropped and before -// any previous guard is dropped. -#[cfg(bootstrap)] -unsafe fn set_task_context(cx: &mut Context<'_>) -> SetOnDrop { - // transmute the context's lifetime to 'static so we can store it. - let cx = core::mem::transmute::<&mut Context<'_>, &mut Context<'static>>(cx); - let old_cx = TLS_CX.with(|tls_cx| tls_cx.replace(Some(NonNull::from(cx)))); - SetOnDrop(old_cx) -} - -#[cfg(bootstrap)] -#[doc(hidden)] -#[unstable(feature = "gen_future", issue = "50547")] -/// Polls a future in the current thread-local task waker. -pub fn poll_with_tls_context(f: Pin<&mut F>) -> Poll -where - F: Future, -{ - let cx_ptr = TLS_CX.with(|tls_cx| { - // Clear the entry so that nested `get_task_waker` calls - // will fail or set their own value. - tls_cx.replace(None) - }); - let _reset = SetOnDrop(cx_ptr); - - let mut cx_ptr = cx_ptr.expect( - "TLS Context not set. This is a rustc bug. \ - Please file an issue on https://github.com/rust-lang/rust.", - ); - - // Safety: we've ensured exclusive access to the context by - // removing the pointer from TLS, only to be replaced once - // we're done with it. - // - // The pointer that was inserted came from an `&mut Context<'_>`, - // so it is safe to treat as mutable. - unsafe { F::poll(f, cx_ptr.as_mut()) } -} diff --git a/src/libstd/lib.rs b/src/libstd/lib.rs index 9d2810cacc2bf..5fd15bb8fe4f3 100644 --- a/src/libstd/lib.rs +++ b/src/libstd/lib.rs @@ -242,7 +242,7 @@ #![feature(atomic_mut_ptr)] #![feature(box_syntax)] #![feature(c_variadic)] -#![cfg_attr(not(bootstrap), feature(cfg_accessible))] +#![feature(cfg_accessible)] #![feature(cfg_target_has_atomic)] #![feature(cfg_target_thread_local)] #![feature(char_error_internals)] @@ -281,7 +281,7 @@ #![feature(maybe_uninit_ref)] #![feature(maybe_uninit_slice)] #![feature(needs_panic_runtime)] -#![cfg_attr(not(bootstrap), feature(negative_impls))] +#![feature(negative_impls)] #![feature(never_type)] #![feature(nll)] #![feature(optin_builtin_traits)] @@ -298,8 +298,7 @@ #![feature(shrink_to)] #![feature(slice_concat_ext)] #![feature(slice_internals)] -#![cfg_attr(bootstrap, feature(specialization))] -#![cfg_attr(not(bootstrap), feature(min_specialization))] +#![feature(min_specialization)] #![feature(staged_api)] #![feature(std_internals)] #![feature(stdsimd)] diff --git a/src/libstd/panicking.rs b/src/libstd/panicking.rs index 10078bd4aee82..343b2ee12735f 100644 --- a/src/libstd/panicking.rs +++ b/src/libstd/panicking.rs @@ -271,44 +271,12 @@ pub unsafe fn r#try R>(f: F) -> Result> let mut data = Data { f: ManuallyDrop::new(f) }; let data_ptr = &mut data as *mut _ as *mut u8; - return if do_try(do_call::, data_ptr, do_catch::) == 0 { + return if intrinsics::r#try(do_call::, data_ptr, do_catch::) == 0 { Ok(ManuallyDrop::into_inner(data.r)) } else { Err(ManuallyDrop::into_inner(data.p)) }; - // Compatibility wrapper around the try intrinsic for bootstrap. - // - // We also need to mark it #[inline(never)] to work around a bug on MinGW - // targets: the unwinding implementation was relying on UB, but this only - // becomes a problem in practice if inlining is involved. - #[cfg(not(bootstrap))] - use intrinsics::r#try as do_try; - #[cfg(bootstrap)] - #[inline(never)] - unsafe fn do_try(try_fn: fn(*mut u8), data: *mut u8, catch_fn: fn(*mut u8, *mut u8)) -> i32 { - use crate::mem::MaybeUninit; - #[cfg(target_env = "msvc")] - type TryPayload = [u64; 2]; - #[cfg(not(target_env = "msvc"))] - type TryPayload = *mut u8; - - let mut payload: MaybeUninit = MaybeUninit::uninit(); - let payload_ptr = payload.as_mut_ptr() as *mut u8; - let r = intrinsics::r#try(try_fn, data, payload_ptr); - if r != 0 { - #[cfg(target_env = "msvc")] - { - catch_fn(data, payload_ptr) - } - #[cfg(not(target_env = "msvc"))] - { - catch_fn(data, payload.assume_init()) - } - } - r - } - // We consider unwinding to be rare, so mark this function as cold. However, // do not mark it no-inline -- that decision is best to leave to the // optimizer (in most cases this function is not inlined even as a normal, @@ -320,9 +288,7 @@ pub unsafe fn r#try R>(f: F) -> Result> obj } - // See comment on do_try above for why #[inline(never)] is needed on bootstrap. - #[cfg_attr(bootstrap, inline(never))] - #[cfg_attr(not(bootstrap), inline)] + #[inline] fn do_call R, R>(data: *mut u8) { unsafe { let data = data as *mut Data; diff --git a/src/libstd/prelude/v1.rs b/src/libstd/prelude/v1.rs index 92e3ea8485036..0fbd6b62f18ff 100644 --- a/src/libstd/prelude/v1.rs +++ b/src/libstd/prelude/v1.rs @@ -54,7 +54,6 @@ pub use core::prelude::v1::{ PartialEq, PartialOrd, RustcDecodable, RustcEncodable, }; -#[cfg(not(bootstrap))] #[unstable( feature = "cfg_accessible", issue = "64797", diff --git a/src/stage0.txt b/src/stage0.txt index 1c7c9f9aff095..150d7a0943db0 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+1).0` for Cargo where they were released on `date`. -date: 2020-03-12 +date: 2020-04-22 rustc: beta cargo: beta @@ -20,7 +20,7 @@ cargo: beta # bootstrapping issues with use of new syntax in this repo. If you're looking at # the beta/stable branch, this key should be omitted, as we don't want to depend # on rustfmt from nightly there. -rustfmt: nightly-2020-01-31 +rustfmt: nightly-2020-04-22 # When making a stable release the process currently looks like: # diff --git a/src/tools/compiletest/src/runtest.rs b/src/tools/compiletest/src/runtest.rs index 1dd5adb2209ef..b2d477553361a 100644 --- a/src/tools/compiletest/src/runtest.rs +++ b/src/tools/compiletest/src/runtest.rs @@ -45,7 +45,7 @@ fn disable_error_reporting R, R>(f: F) -> R { use winapi::um::winbase::SEM_NOGPFAULTERRORBOX; lazy_static! { - static ref LOCK: Mutex<()> = { Mutex::new(()) }; + static ref LOCK: Mutex<()> = Mutex::new(()); } // Error mode is a global variable, so lock it so only one thread will change it let _lock = LOCK.lock().unwrap();