about summary refs log tree commit diff
path: root/src/libcore
diff options
context:
space:
mode:
authorMark Rousskov <mark.simulacrum@gmail.com>2020-04-22 15:45:35 -0400
committerMark Rousskov <mark.simulacrum@gmail.com>2020-04-25 09:25:33 -0400
commit93eed402adbe9e7a532995500d50716d52eefee9 (patch)
treeef6d0177fa8dac0ed4edff1de6ee9cf6a3e6b016 /src/libcore
parent0b958790b336738540d027d645718713849638d7 (diff)
Bump bootstrap compiler
Diffstat (limited to 'src/libcore')
-rw-r--r--src/libcore/clone.rs1
-rw-r--r--src/libcore/convert/num.rs9
-rw-r--r--src/libcore/future/mod.rs6
-rw-r--r--src/libcore/intrinsics.rs33
-rw-r--r--src/libcore/lib.rs2
-rw-r--r--src/libcore/macros/mod.rs46
-rw-r--r--src/libcore/marker.rs2
-rw-r--r--src/libcore/mem/maybe_uninit.rs12
-rw-r--r--src/libcore/mem/mod.rs8
-rw-r--r--src/libcore/ops/deref.rs1
-rw-r--r--src/libcore/ops/index.rs4
-rw-r--r--src/libcore/panicking.rs29
-rw-r--r--src/libcore/prelude/v1.rs1
-rw-r--r--src/libcore/ptr/const_ptr.rs1
-rw-r--r--src/libcore/ptr/mut_ptr.rs1
-rw-r--r--src/libcore/slice/mod.rs4
16 files changed, 10 insertions, 150 deletions
diff --git a/src/libcore/clone.rs b/src/libcore/clone.rs
index 6165941eb3d..7784ec687ea 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<T: ?Sized> !Clone for &mut T {}
 }
diff --git a/src/libcore/convert/num.rs b/src/libcore/convert/num.rs
index 66ae760fc1f..6dd0522f7f6 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 a6b769147d0..e7f681c2e94 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<Context<'static>>);
 
 #[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<T>(gen: T) -> impl Future<Output = T::Return>
 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 75c73130891..45633dc3ca5 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: ?Sized>(_: &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: ?Sized>(_: &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<T: ?Sized>(_: *const T) -> usize;
-    #[cfg(not(bootstrap))]
     pub fn min_align_of_val<T: ?Sized>(_: *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<T>();
-
-    /// 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<T>();
 
     /// 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<T>();
 
     /// 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<T>();
 
     /// Gets a reference to a static `Location` indicating where it was called.
@@ -1599,15 +1576,8 @@ extern "rust-intrinsic" {
 
     /// Convert with LLVM’s fptoui/fptosi, which may return undef for values out of range
     /// (<https://github.com/rust-lang/rust/issues/10184>)
-    /// This is under stabilization at <https://github.com/rust-lang/rust/issues/67058>
-    #[cfg(bootstrap)]
-    pub fn float_to_int_approx_unchecked<Float: Copy, Int: Copy>(value: Float) -> Int;
-
-    /// Convert with LLVM’s fptoui/fptosi, which may return undef for values out of range
-    /// (<https://github.com/rust-lang/rust/issues/10184>)
     ///
     /// Stabilized as `f32::to_int_unchecked` and `f64::to_int_unchecked`.
-    #[cfg(not(bootstrap))]
     pub fn float_to_int_unchecked<Float: Copy, Int: Copy>(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/lib.rs b/src/libcore/lib.rs
index 1c7bce3fac5..3b7929f0016 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 73404a73e3d..f86eee788c0 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)]
@@ -360,7 +336,7 @@ macro_rules! r#try {
         }
     };
     ($expr:expr,) => {
-        $crate::r#try!($expr)
+        $crate::try!($expr)
     };
 }
 
@@ -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 549933ceeb6..09a8b417e6e 100644
--- a/src/libcore/marker.rs
+++ b/src/libcore/marker.rs
@@ -90,7 +90,7 @@ impl<T: ?Sized> !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 bf39d56fc11..f7ea7eba7b1 100644
--- a/src/libcore/mem/maybe_uninit.rs
+++ b/src/libcore/mem/maybe_uninit.rs
@@ -495,9 +495,6 @@ impl<T> MaybeUninit<T> {
     #[inline(always)]
     #[rustc_diagnostic_item = "assume_init"]
     pub unsafe fn assume_init(self) -> T {
-        #[cfg(bootstrap)]
-        intrinsics::panic_if_uninhabited::<T>();
-        #[cfg(not(bootstrap))]
         intrinsics::assert_inhabited::<T>();
         ManuallyDrop::into_inner(self.value)
     }
@@ -562,9 +559,6 @@ impl<T> MaybeUninit<T> {
     #[unstable(feature = "maybe_uninit_extra", issue = "63567")]
     #[inline(always)]
     pub unsafe fn read(&self) -> T {
-        #[cfg(bootstrap)]
-        intrinsics::panic_if_uninhabited::<T>();
-        #[cfg(not(bootstrap))]
         intrinsics::assert_inhabited::<T>();
         self.as_ptr().read()
     }
@@ -627,9 +621,6 @@ impl<T> MaybeUninit<T> {
     #[unstable(feature = "maybe_uninit_ref", issue = "63568")]
     #[inline(always)]
     pub unsafe fn get_ref(&self) -> &T {
-        #[cfg(bootstrap)]
-        intrinsics::panic_if_uninhabited::<T>();
-        #[cfg(not(bootstrap))]
         intrinsics::assert_inhabited::<T>();
         &*self.value
     }
@@ -748,9 +739,6 @@ impl<T> MaybeUninit<T> {
     #[unstable(feature = "maybe_uninit_ref", issue = "63568")]
     #[inline(always)]
     pub unsafe fn get_mut(&mut self) -> &mut T {
-        #[cfg(bootstrap)]
-        intrinsics::panic_if_uninhabited::<T>();
-        #[cfg(not(bootstrap))]
         intrinsics::assert_inhabited::<T>();
         &mut *self.value
     }
diff --git a/src/libcore/mem/mod.rs b/src/libcore/mem/mod.rs
index 7fcfbf10814..b1bbcaeab8d 100644
--- a/src/libcore/mem/mod.rs
+++ b/src/libcore/mem/mod.rs
@@ -378,7 +378,6 @@ pub fn size_of_val<T: ?Sized>(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<T: ?Sized>(val: *const T) -> usize {
     intrinsics::size_of_val(val)
@@ -509,7 +508,6 @@ pub fn align_of_val<T: ?Sized>(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<T: ?Sized>(val: *const T) -> usize {
     intrinsics::min_align_of_val(val)
@@ -621,10 +619,7 @@ pub const fn needs_drop<T>() -> bool {
 #[allow(deprecated)]
 #[rustc_diagnostic_item = "mem_zeroed"]
 pub unsafe fn zeroed<T>() -> T {
-    #[cfg(not(bootstrap))]
     intrinsics::assert_zero_valid::<T>();
-    #[cfg(bootstrap)]
-    intrinsics::panic_if_uninhabited::<T>();
     MaybeUninit::zeroed().assume_init()
 }
 
@@ -657,10 +652,7 @@ pub unsafe fn zeroed<T>() -> T {
 #[allow(deprecated)]
 #[rustc_diagnostic_item = "mem_uninitialized"]
 pub unsafe fn uninitialized<T>() -> T {
-    #[cfg(not(bootstrap))]
     intrinsics::assert_uninit_valid::<T>();
-    #[cfg(bootstrap)]
-    intrinsics::panic_if_uninhabited::<T>();
     MaybeUninit::uninit().assume_init()
 }
 
diff --git a/src/libcore/ops/deref.rs b/src/libcore/ops/deref.rs
index e2deeb55661..6e96aa330ff 100644
--- a/src/libcore/ops/deref.rs
+++ b/src/libcore/ops/deref.rs
@@ -81,7 +81,6 @@ impl<T: ?Sized> Deref for &T {
     }
 }
 
-#[cfg(not(bootstrap))]
 #[stable(feature = "rust1", since = "1.0.0")]
 impl<T: ?Sized> !DerefMut for &T {}
 
diff --git a/src/libcore/ops/index.rs b/src/libcore/ops/index.rs
index 64dd633f75d..763b33606fe 100644
--- a/src/libcore/ops/index.rs
+++ b/src/libcore/ops/index.rs
@@ -65,7 +65,7 @@ pub trait Index<Idx: ?Sized> {
 
     /// 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 <https://doc.rust-lang.org/book/ch08-02-strings.html#ind
 pub trait IndexMut<Idx: ?Sized>: Index<Idx> {
     /// 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 1e4209fd26b..94ea9b78828 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 6a51d39ab9d..b4fff3d67b5 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 729e0b897c0..35a0852bbf5 100644
--- a/src/libcore/ptr/const_ptr.rs
+++ b/src/libcore/ptr/const_ptr.rs
@@ -706,7 +706,6 @@ impl<T: ?Sized> *const T {
     }
 }
 
-#[cfg(not(bootstrap))]
 #[lang = "const_slice_ptr"]
 impl<T> *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 3b7e83bf37f..dbd92ce5fcc 100644
--- a/src/libcore/ptr/mut_ptr.rs
+++ b/src/libcore/ptr/mut_ptr.rs
@@ -894,7 +894,6 @@ impl<T: ?Sized> *mut T {
     }
 }
 
-#[cfg(not(bootstrap))]
 #[lang = "mut_slice_ptr"]
 impl<T> *mut [T] {
     /// Returns the length of a raw slice.
diff --git a/src/libcore/slice/mod.rs b/src/libcore/slice/mod.rs
index dc395bcfba5..7b357bb487a 100644
--- a/src/libcore/slice/mod.rs
+++ b/src/libcore/slice/mod.rs
@@ -2831,13 +2831,13 @@ pub trait SliceIndex<T: ?Sized>: 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;
 }