Skip to content

Commit

Permalink
Auto merge of rust-lang#95678 - pietroalbini:pa-1.62.0-bootstrap, r=M…
Browse files Browse the repository at this point in the history
…ark-Simulacrum

Bump bootstrap compiler to 1.61.0 beta

This PR bumps the bootstrap compiler to the 1.61.0 beta. The first commit changes the stage0 compiler, the second commit applies the "mechanical" changes and the third and fourth commits apply changes explained in the relevant comments.

r? `@Mark-Simulacrum`
  • Loading branch information
bors committed Apr 7, 2022
2 parents 8cd6080 + b500a78 commit f565016
Show file tree
Hide file tree
Showing 50 changed files with 524 additions and 697 deletions.
1 change: 0 additions & 1 deletion compiler/rustc_llvm/src/lib.rs
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
#![feature(nll)]
#![cfg_attr(bootstrap, feature(native_link_modifiers))]
#![doc(html_root_url = "https://doc.rust-lang.org/nightly/nightly-rustc/")]

// NOTE: This crate only exists to allow linking on mingw targets.
Expand Down
2 changes: 1 addition & 1 deletion compiler/rustc_middle/src/mir/interpret/allocation.rs
Original file line number Diff line number Diff line change
Expand Up @@ -58,7 +58,7 @@ pub struct Allocation<Tag = AllocId, Extra = ()> {
/// means that both the inner type (`Allocation`) and the outer type
/// (`ConstAllocation`) are used quite a bit.
#[derive(Copy, Clone, PartialEq, Eq, PartialOrd, Ord, Hash, HashStable)]
#[cfg_attr(not(bootstrap), rustc_pass_by_value)]
#[rustc_pass_by_value]
pub struct ConstAllocation<'tcx, Tag = AllocId, Extra = ()>(
pub Interned<'tcx, Allocation<Tag, Extra>>,
);
Expand Down
2 changes: 1 addition & 1 deletion compiler/rustc_middle/src/ty/adt.rs
Original file line number Diff line number Diff line change
Expand Up @@ -161,7 +161,7 @@ impl<'a> HashStable<StableHashingContext<'a>> for AdtDefData {
}

#[derive(Copy, Clone, PartialEq, Eq, Hash, Ord, PartialOrd, HashStable)]
#[cfg_attr(not(bootstrap), rustc_pass_by_value)]
#[rustc_pass_by_value]
pub struct AdtDef<'tcx>(pub Interned<'tcx, AdtDefData>);

impl<'tcx> AdtDef<'tcx> {
Expand Down
2 changes: 1 addition & 1 deletion compiler/rustc_target/src/abi/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -1262,7 +1262,7 @@ impl<'a> fmt::Debug for LayoutS<'a> {
}

#[derive(Copy, Clone, PartialEq, Eq, Hash, HashStable_Generic)]
#[cfg_attr(not(bootstrap), rustc_pass_by_value)]
#[rustc_pass_by_value]
pub struct Layout<'a>(pub Interned<'a, LayoutS<'a>>);

impl<'a> fmt::Debug for Layout<'a> {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -307,17 +307,6 @@ impl<'cx, 'tcx> SelectionContext<'cx, 'tcx> {
self.assemble_builtin_bound_candidates(sized_conditions, &mut candidates);
} else if lang_items.unsize_trait() == Some(def_id) {
self.assemble_candidates_for_unsizing(obligation, &mut candidates);
} else if lang_items.drop_trait() == Some(def_id)
&& obligation.predicate.is_const_if_const()
{
// holds to make it easier to transition
// FIXME(fee1-dead): add a note for selection error of `~const Drop`
// when beta is bumped
// FIXME: remove this when beta is bumped
#[cfg(bootstrap)]
{}

candidates.vec.push(SelectionCandidate::ConstDestructCandidate(None))
} else if lang_items.destruct_trait() == Some(def_id) {
self.assemble_const_destruct_candidates(obligation, &mut candidates);
} else {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -1106,13 +1106,6 @@ impl<'cx, 'tcx> SelectionContext<'cx, 'tcx> {
}

let drop_trait = self.tcx().require_lang_item(LangItem::Drop, None);
// FIXME: remove if statement below when beta is bumped
#[cfg(bootstrap)]
{}

if obligation.predicate.skip_binder().def_id() == drop_trait {
return Ok(ImplSourceConstDestructData { nested: vec![] });
}

let tcx = self.tcx();
let self_ty = self.infcx.shallow_resolve(obligation.self_ty());
Expand Down
6 changes: 1 addition & 5 deletions library/alloc/src/alloc.rs
Original file line number Diff line number Diff line change
Expand Up @@ -326,16 +326,12 @@ unsafe fn exchange_malloc(size: usize, align: usize) -> *mut u8 {
#[cfg_attr(not(test), lang = "box_free")]
#[inline]
#[rustc_const_unstable(feature = "const_box", issue = "92521")]
#[cfg_attr(not(bootstrap), allow(drop_bounds))] // FIXME remove `~const Drop` and this attr when bumping
// This signature has to be the same as `Box`, otherwise an ICE will happen.
// When an additional parameter to `Box` is added (like `A: Allocator`), this has to be added here as
// well.
// For example if `Box` is changed to `struct Box<T: ?Sized, A: Allocator>(Unique<T>, A)`,
// this function has to be changed to `fn box_free<T: ?Sized, A: Allocator>(Unique<T>, A)` as well.
pub(crate) const unsafe fn box_free<
T: ?Sized,
A: ~const Allocator + ~const Drop + ~const Destruct,
>(
pub(crate) const unsafe fn box_free<T: ?Sized, A: ~const Allocator + ~const Destruct>(
ptr: Unique<T>,
alloc: A,
) {
Expand Down
1 change: 0 additions & 1 deletion library/alloc/src/borrow.rs
Original file line number Diff line number Diff line change
Expand Up @@ -331,7 +331,6 @@ impl<B: ?Sized + ToOwned> Cow<'_, B> {

#[stable(feature = "rust1", since = "1.0.0")]
#[rustc_const_unstable(feature = "const_deref", issue = "88955")]
#[cfg_attr(not(bootstrap), allow(drop_bounds))] // FIXME remove `~const Drop` and this attr when bumping
impl<B: ?Sized + ToOwned> const Deref for Cow<'_, B>
where
B::Owned: ~const Borrow<B>,
Expand Down
26 changes: 9 additions & 17 deletions library/alloc/src/boxed.rs
Original file line number Diff line number Diff line change
Expand Up @@ -349,10 +349,9 @@ impl<T, A: Allocator> Box<T, A> {
#[rustc_const_unstable(feature = "const_box", issue = "92521")]
#[must_use]
#[inline]
#[cfg_attr(not(bootstrap), allow(drop_bounds))] // FIXME remove `~const Drop` and this attr when bumping
pub const fn new_in(x: T, alloc: A) -> Self
where
A: ~const Allocator + ~const Drop + ~const Destruct,
A: ~const Allocator + ~const Destruct,
{
let mut boxed = Self::new_uninit_in(alloc);
unsafe {
Expand All @@ -379,11 +378,10 @@ impl<T, A: Allocator> Box<T, A> {
#[unstable(feature = "allocator_api", issue = "32838")]
#[rustc_const_unstable(feature = "const_box", issue = "92521")]
#[inline]
#[cfg_attr(not(bootstrap), allow(drop_bounds))] // FIXME remove `~const Drop` and this attr when bumping
pub const fn try_new_in(x: T, alloc: A) -> Result<Self, AllocError>
where
T: ~const Drop + ~const Destruct,
A: ~const Allocator + ~const Drop + ~const Destruct,
T: ~const Destruct,
A: ~const Allocator + ~const Destruct,
{
let mut boxed = Self::try_new_uninit_in(alloc)?;
unsafe {
Expand Down Expand Up @@ -417,10 +415,9 @@ impl<T, A: Allocator> Box<T, A> {
#[cfg(not(no_global_oom_handling))]
#[must_use]
// #[unstable(feature = "new_uninit", issue = "63291")]
#[cfg_attr(not(bootstrap), allow(drop_bounds))] // FIXME remove `~const Drop` and this attr when bumping
pub const fn new_uninit_in(alloc: A) -> Box<mem::MaybeUninit<T>, A>
where
A: ~const Allocator + ~const Drop + ~const Destruct,
A: ~const Allocator + ~const Destruct,
{
let layout = Layout::new::<mem::MaybeUninit<T>>();
// NOTE: Prefer match over unwrap_or_else since closure sometimes not inlineable.
Expand Down Expand Up @@ -456,10 +453,9 @@ impl<T, A: Allocator> Box<T, A> {
#[unstable(feature = "allocator_api", issue = "32838")]
// #[unstable(feature = "new_uninit", issue = "63291")]
#[rustc_const_unstable(feature = "const_box", issue = "92521")]
#[cfg_attr(not(bootstrap), allow(drop_bounds))] // FIXME remove `~const Drop` and this attr when bumping
pub const fn try_new_uninit_in(alloc: A) -> Result<Box<mem::MaybeUninit<T>, A>, AllocError>
where
A: ~const Allocator + ~const Drop + ~const Destruct,
A: ~const Allocator + ~const Destruct,
{
let layout = Layout::new::<mem::MaybeUninit<T>>();
let ptr = alloc.allocate(layout)?.cast();
Expand Down Expand Up @@ -491,10 +487,9 @@ impl<T, A: Allocator> Box<T, A> {
#[cfg(not(no_global_oom_handling))]
// #[unstable(feature = "new_uninit", issue = "63291")]
#[must_use]
#[cfg_attr(not(bootstrap), allow(drop_bounds))] // FIXME remove `~const Drop` and this attr when bumping
pub const fn new_zeroed_in(alloc: A) -> Box<mem::MaybeUninit<T>, A>
where
A: ~const Allocator + ~const Drop + ~const Destruct,
A: ~const Allocator + ~const Destruct,
{
let layout = Layout::new::<mem::MaybeUninit<T>>();
// NOTE: Prefer match over unwrap_or_else since closure sometimes not inlineable.
Expand Down Expand Up @@ -530,10 +525,9 @@ impl<T, A: Allocator> Box<T, A> {
#[unstable(feature = "allocator_api", issue = "32838")]
// #[unstable(feature = "new_uninit", issue = "63291")]
#[rustc_const_unstable(feature = "const_box", issue = "92521")]
#[cfg_attr(not(bootstrap), allow(drop_bounds))] // FIXME remove `~const Drop` and this attr when bumping
pub const fn try_new_zeroed_in(alloc: A) -> Result<Box<mem::MaybeUninit<T>, A>, AllocError>
where
A: ~const Allocator + ~const Drop + ~const Destruct,
A: ~const Allocator + ~const Destruct,
{
let layout = Layout::new::<mem::MaybeUninit<T>>();
let ptr = alloc.allocate_zeroed(layout)?.cast();
Expand All @@ -547,10 +541,9 @@ impl<T, A: Allocator> Box<T, A> {
#[rustc_const_unstable(feature = "const_box", issue = "92521")]
#[must_use]
#[inline(always)]
#[cfg_attr(not(bootstrap), allow(drop_bounds))] // FIXME remove `~const Drop` and this attr when bumping
pub const fn pin_in(x: T, alloc: A) -> Pin<Self>
where
A: 'static + ~const Allocator + ~const Drop + ~const Destruct,
A: 'static + ~const Allocator + ~const Destruct,
{
Self::into_pin(Self::new_in(x, alloc))
}
Expand Down Expand Up @@ -579,10 +572,9 @@ impl<T, A: Allocator> Box<T, A> {
#[unstable(feature = "box_into_inner", issue = "80437")]
#[rustc_const_unstable(feature = "const_box", issue = "92521")]
#[inline]
#[cfg_attr(not(bootstrap), allow(drop_bounds))] // FIXME remove `~const Drop` and this attr when bumping
pub const fn into_inner(boxed: Self) -> T
where
Self: ~const Drop + ~const Destruct,
Self: ~const Destruct,
{
*boxed
}
Expand Down
1 change: 0 additions & 1 deletion library/alloc/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -141,7 +141,6 @@
#![feature(box_syntax)]
#![feature(cfg_sanitize)]
#![feature(const_deref)]
#![cfg_attr(bootstrap, feature(const_fn_trait_bound))]
#![feature(const_mut_refs)]
#![feature(const_ptr_write)]
#![feature(const_precise_live_drops)]
Expand Down
28 changes: 13 additions & 15 deletions library/alloc/src/slice.rs
Original file line number Diff line number Diff line change
Expand Up @@ -237,7 +237,6 @@ mod hack {
}
}

#[cfg_attr(bootstrap, lang = "slice_alloc")]
#[cfg(not(test))]
impl<T> [T] {
/// Sorts the slice.
Expand Down Expand Up @@ -267,7 +266,7 @@ impl<T> [T] {
/// assert!(v == [-5, -3, 1, 2, 4]);
/// ```
#[cfg(not(no_global_oom_handling))]
#[cfg_attr(not(bootstrap), rustc_allow_incoherent_impl)]
#[rustc_allow_incoherent_impl]
#[stable(feature = "rust1", since = "1.0.0")]
#[inline]
pub fn sort(&mut self)
Expand Down Expand Up @@ -323,7 +322,7 @@ impl<T> [T] {
/// assert!(v == [5, 4, 3, 2, 1]);
/// ```
#[cfg(not(no_global_oom_handling))]
#[cfg_attr(not(bootstrap), rustc_allow_incoherent_impl)]
#[rustc_allow_incoherent_impl]
#[stable(feature = "rust1", since = "1.0.0")]
#[inline]
pub fn sort_by<F>(&mut self, mut compare: F)
Expand Down Expand Up @@ -365,7 +364,7 @@ impl<T> [T] {
/// assert!(v == [1, 2, -3, 4, -5]);
/// ```
#[cfg(not(no_global_oom_handling))]
#[cfg_attr(not(bootstrap), rustc_allow_incoherent_impl)]
#[rustc_allow_incoherent_impl]
#[stable(feature = "slice_sort_by_key", since = "1.7.0")]
#[inline]
pub fn sort_by_key<K, F>(&mut self, mut f: F)
Expand Down Expand Up @@ -412,7 +411,7 @@ impl<T> [T] {
///
/// [pdqsort]: https://github.com/orlp/pdqsort
#[cfg(not(no_global_oom_handling))]
#[cfg_attr(not(bootstrap), rustc_allow_incoherent_impl)]
#[rustc_allow_incoherent_impl]
#[stable(feature = "slice_sort_by_cached_key", since = "1.34.0")]
#[inline]
pub fn sort_by_cached_key<K, F>(&mut self, f: F)
Expand Down Expand Up @@ -471,7 +470,7 @@ impl<T> [T] {
/// // Here, `s` and `x` can be modified independently.
/// ```
#[cfg(not(no_global_oom_handling))]
#[cfg_attr(not(bootstrap), rustc_allow_incoherent_impl)]
#[rustc_allow_incoherent_impl]
#[rustc_conversion_suggestion]
#[stable(feature = "rust1", since = "1.0.0")]
#[inline]
Expand All @@ -496,7 +495,7 @@ impl<T> [T] {
/// // Here, `s` and `x` can be modified independently.
/// ```
#[cfg(not(no_global_oom_handling))]
#[cfg_attr(not(bootstrap), rustc_allow_incoherent_impl)]
#[rustc_allow_incoherent_impl]
#[inline]
#[unstable(feature = "allocator_api", issue = "32838")]
pub fn to_vec_in<A: Allocator>(&self, alloc: A) -> Vec<T, A>
Expand All @@ -521,7 +520,7 @@ impl<T> [T] {
///
/// assert_eq!(x, vec![10, 40, 30]);
/// ```
#[cfg_attr(not(bootstrap), rustc_allow_incoherent_impl)]
#[rustc_allow_incoherent_impl]
#[stable(feature = "rust1", since = "1.0.0")]
#[inline]
pub fn into_vec<A: Allocator>(self: Box<Self, A>) -> Vec<T, A> {
Expand Down Expand Up @@ -549,7 +548,7 @@ impl<T> [T] {
/// // this will panic at runtime
/// b"0123456789abcdef".repeat(usize::MAX);
/// ```
#[cfg_attr(not(bootstrap), rustc_allow_incoherent_impl)]
#[rustc_allow_incoherent_impl]
#[cfg(not(no_global_oom_handling))]
#[stable(feature = "repeat_generic_slice", since = "1.40.0")]
pub fn repeat(&self, n: usize) -> Vec<T>
Expand Down Expand Up @@ -618,7 +617,7 @@ impl<T> [T] {
/// assert_eq!(["hello", "world"].concat(), "helloworld");
/// assert_eq!([[1, 2], [3, 4]].concat(), [1, 2, 3, 4]);
/// ```
#[cfg_attr(not(bootstrap), rustc_allow_incoherent_impl)]
#[rustc_allow_incoherent_impl]
#[stable(feature = "rust1", since = "1.0.0")]
pub fn concat<Item: ?Sized>(&self) -> <Self as Concat<Item>>::Output
where
Expand All @@ -637,7 +636,7 @@ impl<T> [T] {
/// assert_eq!([[1, 2], [3, 4]].join(&0), [1, 2, 0, 3, 4]);
/// assert_eq!([[1, 2], [3, 4]].join(&[0, 0][..]), [1, 2, 0, 0, 3, 4]);
/// ```
#[cfg_attr(not(bootstrap), rustc_allow_incoherent_impl)]
#[rustc_allow_incoherent_impl]
#[stable(feature = "rename_connect_to_join", since = "1.3.0")]
pub fn join<Separator>(&self, sep: Separator) -> <Self as Join<Separator>>::Output
where
Expand All @@ -656,7 +655,7 @@ impl<T> [T] {
/// assert_eq!(["hello", "world"].connect(" "), "hello world");
/// assert_eq!([[1, 2], [3, 4]].connect(&0), [1, 2, 0, 3, 4]);
/// ```
#[cfg_attr(not(bootstrap), rustc_allow_incoherent_impl)]
#[rustc_allow_incoherent_impl]
#[stable(feature = "rust1", since = "1.0.0")]
#[rustc_deprecated(since = "1.3.0", reason = "renamed to join")]
pub fn connect<Separator>(&self, sep: Separator) -> <Self as Join<Separator>>::Output
Expand All @@ -667,7 +666,6 @@ impl<T> [T] {
}
}

#[cfg_attr(bootstrap, lang = "slice_u8_alloc")]
#[cfg(not(test))]
impl [u8] {
/// Returns a vector containing a copy of this slice where each byte
Expand All @@ -680,7 +678,7 @@ impl [u8] {
///
/// [`make_ascii_uppercase`]: slice::make_ascii_uppercase
#[cfg(not(no_global_oom_handling))]
#[cfg_attr(not(bootstrap), rustc_allow_incoherent_impl)]
#[rustc_allow_incoherent_impl]
#[must_use = "this returns the uppercase bytes as a new Vec, \
without modifying the original"]
#[stable(feature = "ascii_methods_on_intrinsics", since = "1.23.0")]
Expand All @@ -701,7 +699,7 @@ impl [u8] {
///
/// [`make_ascii_lowercase`]: slice::make_ascii_lowercase
#[cfg(not(no_global_oom_handling))]
#[cfg_attr(not(bootstrap), rustc_allow_incoherent_impl)]
#[rustc_allow_incoherent_impl]
#[must_use = "this returns the lowercase bytes as a new Vec, \
without modifying the original"]
#[stable(feature = "ascii_methods_on_intrinsics", since = "1.23.0")]
Expand Down
Loading

0 comments on commit f565016

Please sign in to comment.