Skip to content

Commit

Permalink
Auto merge of #98673 - pietroalbini:pa-bootstrap-update, r=Mark-Simul…
Browse files Browse the repository at this point in the history
…acrum

Bump bootstrap compiler

r? `@Mark-Simulacrum`
  • Loading branch information
bors committed Jul 3, 2022
2 parents c5f240d + 52da6d3 commit 4b60c22
Show file tree
Hide file tree
Showing 15 changed files with 24 additions and 115 deletions.
25 changes: 4 additions & 21 deletions alloc/src/boxed.rs
Expand Up @@ -206,7 +206,7 @@ impl<T> Box<T> {
/// ```
/// let five = Box::new(5);
/// ```
#[cfg(all(not(no_global_oom_handling), not(bootstrap)))]
#[cfg(all(not(no_global_oom_handling)))]
#[inline(always)]
#[stable(feature = "rust1", since = "1.0.0")]
#[must_use]
Expand All @@ -215,23 +215,6 @@ impl<T> Box<T> {
Box::new(x)
}

/// Allocates memory on the heap and then places `x` into it.
///
/// This doesn't actually allocate if `T` is zero-sized.
///
/// # Examples
///
/// ```
/// let five = Box::new(5);
/// ```
#[cfg(all(not(no_global_oom_handling), bootstrap))]
#[inline(always)]
#[stable(feature = "rust1", since = "1.0.0")]
#[must_use]
pub fn new(x: T) -> Self {
box x
}

/// Constructs a new box with uninitialized contents.
///
/// # Examples
Expand Down Expand Up @@ -296,7 +279,7 @@ impl<T> Box<T> {
#[must_use]
#[inline(always)]
pub fn pin(x: T) -> Pin<Box<T>> {
(#[cfg_attr(not(bootstrap), rustc_box)]
(#[rustc_box]
Box::new(x))
.into()
}
Expand Down Expand Up @@ -1255,7 +1238,7 @@ unsafe impl<#[may_dangle] T: ?Sized, A: Allocator> Drop for Box<T, A> {
impl<T: Default> Default for Box<T> {
/// Creates a `Box<T>`, with the `Default` value for T.
fn default() -> Self {
#[cfg_attr(not(bootstrap), rustc_box)]
#[rustc_box]
Box::new(T::default())
}
}
Expand Down Expand Up @@ -1628,7 +1611,7 @@ impl<T, const N: usize> From<[T; N]> for Box<[T]> {
/// println!("{boxed:?}");
/// ```
fn from(array: [T; N]) -> Box<[T]> {
#[cfg_attr(not(bootstrap), rustc_box)]
#[rustc_box]
Box::new(array)
}
}
Expand Down
1 change: 0 additions & 1 deletion alloc/src/lib.rs
Expand Up @@ -149,7 +149,6 @@
#![feature(allocator_internals)]
#![feature(allow_internal_unstable)]
#![feature(associated_type_bounds)]
#![cfg_attr(bootstrap, feature(box_syntax))]
#![feature(cfg_sanitize)]
#![feature(const_deref)]
#![feature(const_mut_refs)]
Expand Down
20 changes: 1 addition & 19 deletions alloc/src/macros.rs
Expand Up @@ -34,7 +34,7 @@
/// be mindful of side effects.
///
/// [`Vec`]: crate::vec::Vec
#[cfg(all(not(no_global_oom_handling), not(test), not(bootstrap)))]
#[cfg(all(not(no_global_oom_handling), not(test)))]
#[macro_export]
#[stable(feature = "rust1", since = "1.0.0")]
#[rustc_diagnostic_item = "vec_macro"]
Expand All @@ -54,24 +54,6 @@ macro_rules! vec {
);
}

/// Creates a `Vec` containing the arguments (bootstrap version).
#[cfg(all(not(no_global_oom_handling), not(test), bootstrap))]
#[macro_export]
#[stable(feature = "rust1", since = "1.0.0")]
#[rustc_diagnostic_item = "vec_macro"]
#[allow_internal_unstable(box_syntax, liballoc_internals)]
macro_rules! vec {
() => (
$crate::__rust_force_expr!($crate::vec::Vec::new())
);
($elem:expr; $n:expr) => (
$crate::__rust_force_expr!($crate::vec::from_elem($elem, $n))
);
($($x:expr),+ $(,)?) => (
$crate::__rust_force_expr!(<[_]>::into_vec(box [$($x),+]))
);
}

// HACK(japaric): with cfg(test) the inherent `[T]::into_vec` method, which is
// required for this macro definition, is not available. Instead use the
// `slice::into_vec` function which is only available with cfg(test)
Expand Down
2 changes: 1 addition & 1 deletion alloc/src/vec/mod.rs
Expand Up @@ -3017,7 +3017,7 @@ impl<T, const N: usize> From<[T; N]> for Vec<T> {
#[cfg(not(test))]
fn from(s: [T; N]) -> Vec<T> {
<[T]>::into_vec(
#[cfg_attr(not(bootstrap), rustc_box)]
#[rustc_box]
Box::new(s),
)
}
Expand Down
3 changes: 1 addition & 2 deletions core/src/clone.rs
Expand Up @@ -106,7 +106,7 @@ use crate::marker::Destruct;
#[lang = "clone"]
#[rustc_diagnostic_item = "Clone"]
#[rustc_trivial_field_reads]
#[cfg_attr(not(bootstrap), const_trait)]
#[const_trait]
pub trait Clone: Sized {
/// Returns a copy of the value.
///
Expand All @@ -129,7 +129,6 @@ pub trait Clone: Sized {
/// allocations.
#[inline]
#[stable(feature = "rust1", since = "1.0.0")]
#[cfg_attr(bootstrap, default_method_body_is_const)]
fn clone_from(&mut self, source: &Self)
where
Self: ~const Destruct,
Expand Down
9 changes: 2 additions & 7 deletions core/src/cmp.rs
Expand Up @@ -214,7 +214,7 @@ use self::Ordering::*;
append_const_msg,
)
)]
#[cfg_attr(not(bootstrap), const_trait)]
#[const_trait]
#[rustc_diagnostic_item = "PartialEq"]
pub trait PartialEq<Rhs: ?Sized = Self> {
/// This method tests for `self` and `other` values to be equal, and is used
Expand All @@ -227,7 +227,6 @@ pub trait PartialEq<Rhs: ?Sized = Self> {
#[inline]
#[must_use]
#[stable(feature = "rust1", since = "1.0.0")]
#[cfg_attr(bootstrap, default_method_body_is_const)]
fn ne(&self, other: &Rhs) -> bool {
!self.eq(other)
}
Expand Down Expand Up @@ -1054,7 +1053,7 @@ impl PartialOrd for Ordering {
append_const_msg,
)
)]
#[cfg_attr(not(bootstrap), const_trait)]
#[const_trait]
#[rustc_diagnostic_item = "PartialOrd"]
pub trait PartialOrd<Rhs: ?Sized = Self>: PartialEq<Rhs> {
/// This method returns an ordering between `self` and `other` values if one exists.
Expand Down Expand Up @@ -1098,7 +1097,6 @@ pub trait PartialOrd<Rhs: ?Sized = Self>: PartialEq<Rhs> {
#[inline]
#[must_use]
#[stable(feature = "rust1", since = "1.0.0")]
#[cfg_attr(bootstrap, default_method_body_is_const)]
fn lt(&self, other: &Rhs) -> bool {
matches!(self.partial_cmp(other), Some(Less))
}
Expand All @@ -1118,7 +1116,6 @@ pub trait PartialOrd<Rhs: ?Sized = Self>: PartialEq<Rhs> {
#[inline]
#[must_use]
#[stable(feature = "rust1", since = "1.0.0")]
#[cfg_attr(bootstrap, default_method_body_is_const)]
fn le(&self, other: &Rhs) -> bool {
// Pattern `Some(Less | Eq)` optimizes worse than negating `None | Some(Greater)`.
// FIXME: The root cause was fixed upstream in LLVM with:
Expand All @@ -1141,7 +1138,6 @@ pub trait PartialOrd<Rhs: ?Sized = Self>: PartialEq<Rhs> {
#[inline]
#[must_use]
#[stable(feature = "rust1", since = "1.0.0")]
#[cfg_attr(bootstrap, default_method_body_is_const)]
fn gt(&self, other: &Rhs) -> bool {
matches!(self.partial_cmp(other), Some(Greater))
}
Expand All @@ -1161,7 +1157,6 @@ pub trait PartialOrd<Rhs: ?Sized = Self>: PartialEq<Rhs> {
#[inline]
#[must_use]
#[stable(feature = "rust1", since = "1.0.0")]
#[cfg_attr(bootstrap, default_method_body_is_const)]
fn ge(&self, other: &Rhs) -> bool {
matches!(self.partial_cmp(other), Some(Greater | Equal))
}
Expand Down
2 changes: 1 addition & 1 deletion core/src/fmt/mod.rs
Expand Up @@ -2562,7 +2562,7 @@ macro_rules! tuple {

macro_rules! maybe_tuple_doc {
($a:ident @ #[$meta:meta] $item:item) => {
#[cfg_attr(not(bootstrap), doc(tuple_variadic))]
#[doc(tuple_variadic)]
#[doc = "This trait is implemented for tuples up to twelve items long."]
#[$meta]
$item
Expand Down
2 changes: 1 addition & 1 deletion core/src/hash/mod.rs
Expand Up @@ -900,7 +900,7 @@ mod impls {

macro_rules! maybe_tuple_doc {
($a:ident @ #[$meta:meta] $item:item) => {
#[cfg_attr(not(bootstrap), doc(tuple_variadic))]
#[doc(tuple_variadic)]
#[doc = "This trait is implemented for tuples up to twelve items long."]
#[$meta]
$item
Expand Down
4 changes: 2 additions & 2 deletions core/src/primitive_docs.rs
Expand Up @@ -996,7 +996,7 @@ impl<T> (T,) {}
// Fake impl that's only really used for docs.
#[cfg(doc)]
#[stable(feature = "rust1", since = "1.0.0")]
#[cfg_attr(not(bootstrap), doc(tuple_variadic))]
#[doc(tuple_variadic)]
/// This trait is implemented on arbitrary-length tuples.
impl<T: Clone> Clone for (T,) {
fn clone(&self) -> Self {
Expand All @@ -1007,7 +1007,7 @@ impl<T: Clone> Clone for (T,) {
// Fake impl that's only really used for docs.
#[cfg(doc)]
#[stable(feature = "rust1", since = "1.0.0")]
#[cfg_attr(not(bootstrap), doc(tuple_variadic))]
#[doc(tuple_variadic)]
/// This trait is implemented on arbitrary-length tuples.
impl<T: Copy> Copy for (T,) {
// empty
Expand Down
44 changes: 0 additions & 44 deletions core/src/ptr/mod.rs
Expand Up @@ -492,27 +492,6 @@ pub unsafe fn drop_in_place<T: ?Sized>(to_drop: *mut T) {
unsafe { drop_in_place(to_drop) }
}

/// Creates a null raw pointer.
///
/// # Examples
///
/// ```
/// use std::ptr;
///
/// let p: *const i32 = ptr::null();
/// assert!(p.is_null());
/// ```
#[inline(always)]
#[must_use]
#[stable(feature = "rust1", since = "1.0.0")]
#[rustc_promotable]
#[rustc_const_stable(feature = "const_ptr_null", since = "1.24.0")]
#[rustc_diagnostic_item = "ptr_null"]
#[cfg(bootstrap)]
pub const fn null<T>() -> *const T {
invalid(0)
}

/// Creates a null raw pointer.
///
/// # Examples
Expand All @@ -530,32 +509,10 @@ pub const fn null<T>() -> *const T {
#[rustc_const_stable(feature = "const_ptr_null", since = "1.24.0")]
#[rustc_allow_const_fn_unstable(ptr_metadata)]
#[rustc_diagnostic_item = "ptr_null"]
#[cfg(not(bootstrap))]
pub const fn null<T: ?Sized + Thin>() -> *const T {
from_raw_parts(invalid(0), ())
}

/// Creates a null mutable raw pointer.
///
/// # Examples
///
/// ```
/// use std::ptr;
///
/// let p: *mut i32 = ptr::null_mut();
/// assert!(p.is_null());
/// ```
#[inline(always)]
#[must_use]
#[stable(feature = "rust1", since = "1.0.0")]
#[rustc_promotable]
#[rustc_const_stable(feature = "const_ptr_null", since = "1.24.0")]
#[rustc_diagnostic_item = "ptr_null_mut"]
#[cfg(bootstrap)]
pub const fn null_mut<T>() -> *mut T {
invalid_mut(0)
}

/// Creates an invalid pointer with the given address.
///
/// This is different from `addr as *const T`, which creates a pointer that picks up a previously
Expand Down Expand Up @@ -707,7 +664,6 @@ where
#[rustc_const_stable(feature = "const_ptr_null", since = "1.24.0")]
#[rustc_allow_const_fn_unstable(ptr_metadata)]
#[rustc_diagnostic_item = "ptr_null_mut"]
#[cfg(not(bootstrap))]
pub const fn null_mut<T: ?Sized + Thin>() -> *mut T {
from_raw_parts_mut(invalid_mut(0), ())
}
Expand Down
2 changes: 1 addition & 1 deletion core/src/tuple.rs
Expand Up @@ -107,7 +107,7 @@ macro_rules! tuple_impls {
// Otherwise, it hides the docs entirely.
macro_rules! maybe_tuple_doc {
($a:ident @ #[$meta:meta] $item:item) => {
#[cfg_attr(not(bootstrap), doc(tuple_variadic))]
#[doc(tuple_variadic)]
#[doc = "This trait is implemented for tuples up to twelve items long."]
#[$meta]
$item
Expand Down
17 changes: 7 additions & 10 deletions core/tests/ptr.rs
Expand Up @@ -96,17 +96,14 @@ fn test_is_null() {
let nmi: *mut dyn ToString = null_mut::<isize>();
assert!(nmi.is_null());

#[cfg(not(bootstrap))]
{
extern "C" {
type Extern;
}
let ec: *const Extern = null::<Extern>();
assert!(ec.is_null());

let em: *mut Extern = null_mut::<Extern>();
assert!(em.is_null());
extern "C" {
type Extern;
}
let ec: *const Extern = null::<Extern>();
assert!(ec.is_null());

let em: *mut Extern = null_mut::<Extern>();
assert!(em.is_null());
}

#[test]
Expand Down
3 changes: 1 addition & 2 deletions std/src/lib.rs
Expand Up @@ -251,7 +251,6 @@
#![feature(needs_panic_runtime)]
#![feature(negative_impls)]
#![feature(never_type)]
#![cfg_attr(bootstrap, feature(nll))]
#![feature(platform_intrinsics)]
#![feature(prelude_import)]
#![feature(rustc_attrs)]
Expand Down Expand Up @@ -587,7 +586,7 @@ mod backtrace_rs;
#[stable(feature = "rust1", since = "1.0.0")]
#[allow(deprecated, deprecated_in_future)]
pub use core::{
assert_eq, assert_ne, debug_assert, debug_assert_eq, debug_assert_ne, matches, r#try, todo,
assert_eq, assert_ne, debug_assert, debug_assert_eq, debug_assert_ne, matches, todo, r#try,
unimplemented, unreachable, write, writeln,
};

Expand Down
4 changes: 2 additions & 2 deletions std/src/primitive_docs.rs
Expand Up @@ -996,7 +996,7 @@ impl<T> (T,) {}
// Fake impl that's only really used for docs.
#[cfg(doc)]
#[stable(feature = "rust1", since = "1.0.0")]
#[cfg_attr(not(bootstrap), doc(tuple_variadic))]
#[doc(tuple_variadic)]
/// This trait is implemented on arbitrary-length tuples.
impl<T: Clone> Clone for (T,) {
fn clone(&self) -> Self {
Expand All @@ -1007,7 +1007,7 @@ impl<T: Clone> Clone for (T,) {
// Fake impl that's only really used for docs.
#[cfg(doc)]
#[stable(feature = "rust1", since = "1.0.0")]
#[cfg_attr(not(bootstrap), doc(tuple_variadic))]
#[doc(tuple_variadic)]
/// This trait is implemented on arbitrary-length tuples.
impl<T: Copy> Copy for (T,) {
// empty
Expand Down
1 change: 0 additions & 1 deletion unwind/src/lib.rs
@@ -1,7 +1,6 @@
#![no_std]
#![unstable(feature = "panic_unwind", issue = "32837")]
#![feature(link_cfg)]
#![cfg_attr(bootstrap, feature(native_link_modifiers_bundle))]
#![feature(staged_api)]
#![feature(c_unwind)]
#![feature(cfg_target_abi)]
Expand Down

0 comments on commit 4b60c22

Please sign in to comment.