Skip to content

Commit c5e6de2

Browse files
committed
Auto merge of #95678 - pietroalbini:pa-1.62.0-bootstrap, r=Mark-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`
2 parents 8a89897 + 6c50d8d commit c5e6de2

35 files changed

+172
-305
lines changed

alloc/src/alloc.rs

+1-5
Original file line numberDiff line numberDiff line change
@@ -326,16 +326,12 @@ unsafe fn exchange_malloc(size: usize, align: usize) -> *mut u8 {
326326
#[cfg_attr(not(test), lang = "box_free")]
327327
#[inline]
328328
#[rustc_const_unstable(feature = "const_box", issue = "92521")]
329-
#[cfg_attr(not(bootstrap), allow(drop_bounds))] // FIXME remove `~const Drop` and this attr when bumping
330329
// This signature has to be the same as `Box`, otherwise an ICE will happen.
331330
// When an additional parameter to `Box` is added (like `A: Allocator`), this has to be added here as
332331
// well.
333332
// For example if `Box` is changed to `struct Box<T: ?Sized, A: Allocator>(Unique<T>, A)`,
334333
// this function has to be changed to `fn box_free<T: ?Sized, A: Allocator>(Unique<T>, A)` as well.
335-
pub(crate) const unsafe fn box_free<
336-
T: ?Sized,
337-
A: ~const Allocator + ~const Drop + ~const Destruct,
338-
>(
334+
pub(crate) const unsafe fn box_free<T: ?Sized, A: ~const Allocator + ~const Destruct>(
339335
ptr: Unique<T>,
340336
alloc: A,
341337
) {

alloc/src/borrow.rs

-1
Original file line numberDiff line numberDiff line change
@@ -331,7 +331,6 @@ impl<B: ?Sized + ToOwned> Cow<'_, B> {
331331

332332
#[stable(feature = "rust1", since = "1.0.0")]
333333
#[rustc_const_unstable(feature = "const_deref", issue = "88955")]
334-
#[cfg_attr(not(bootstrap), allow(drop_bounds))] // FIXME remove `~const Drop` and this attr when bumping
335334
impl<B: ?Sized + ToOwned> const Deref for Cow<'_, B>
336335
where
337336
B::Owned: ~const Borrow<B>,

alloc/src/boxed.rs

+9-17
Original file line numberDiff line numberDiff line change
@@ -349,10 +349,9 @@ impl<T, A: Allocator> Box<T, A> {
349349
#[rustc_const_unstable(feature = "const_box", issue = "92521")]
350350
#[must_use]
351351
#[inline]
352-
#[cfg_attr(not(bootstrap), allow(drop_bounds))] // FIXME remove `~const Drop` and this attr when bumping
353352
pub const fn new_in(x: T, alloc: A) -> Self
354353
where
355-
A: ~const Allocator + ~const Drop + ~const Destruct,
354+
A: ~const Allocator + ~const Destruct,
356355
{
357356
let mut boxed = Self::new_uninit_in(alloc);
358357
unsafe {
@@ -379,11 +378,10 @@ impl<T, A: Allocator> Box<T, A> {
379378
#[unstable(feature = "allocator_api", issue = "32838")]
380379
#[rustc_const_unstable(feature = "const_box", issue = "92521")]
381380
#[inline]
382-
#[cfg_attr(not(bootstrap), allow(drop_bounds))] // FIXME remove `~const Drop` and this attr when bumping
383381
pub const fn try_new_in(x: T, alloc: A) -> Result<Self, AllocError>
384382
where
385-
T: ~const Drop + ~const Destruct,
386-
A: ~const Allocator + ~const Drop + ~const Destruct,
383+
T: ~const Destruct,
384+
A: ~const Allocator + ~const Destruct,
387385
{
388386
let mut boxed = Self::try_new_uninit_in(alloc)?;
389387
unsafe {
@@ -417,10 +415,9 @@ impl<T, A: Allocator> Box<T, A> {
417415
#[cfg(not(no_global_oom_handling))]
418416
#[must_use]
419417
// #[unstable(feature = "new_uninit", issue = "63291")]
420-
#[cfg_attr(not(bootstrap), allow(drop_bounds))] // FIXME remove `~const Drop` and this attr when bumping
421418
pub const fn new_uninit_in(alloc: A) -> Box<mem::MaybeUninit<T>, A>
422419
where
423-
A: ~const Allocator + ~const Drop + ~const Destruct,
420+
A: ~const Allocator + ~const Destruct,
424421
{
425422
let layout = Layout::new::<mem::MaybeUninit<T>>();
426423
// NOTE: Prefer match over unwrap_or_else since closure sometimes not inlineable.
@@ -456,10 +453,9 @@ impl<T, A: Allocator> Box<T, A> {
456453
#[unstable(feature = "allocator_api", issue = "32838")]
457454
// #[unstable(feature = "new_uninit", issue = "63291")]
458455
#[rustc_const_unstable(feature = "const_box", issue = "92521")]
459-
#[cfg_attr(not(bootstrap), allow(drop_bounds))] // FIXME remove `~const Drop` and this attr when bumping
460456
pub const fn try_new_uninit_in(alloc: A) -> Result<Box<mem::MaybeUninit<T>, A>, AllocError>
461457
where
462-
A: ~const Allocator + ~const Drop + ~const Destruct,
458+
A: ~const Allocator + ~const Destruct,
463459
{
464460
let layout = Layout::new::<mem::MaybeUninit<T>>();
465461
let ptr = alloc.allocate(layout)?.cast();
@@ -491,10 +487,9 @@ impl<T, A: Allocator> Box<T, A> {
491487
#[cfg(not(no_global_oom_handling))]
492488
// #[unstable(feature = "new_uninit", issue = "63291")]
493489
#[must_use]
494-
#[cfg_attr(not(bootstrap), allow(drop_bounds))] // FIXME remove `~const Drop` and this attr when bumping
495490
pub const fn new_zeroed_in(alloc: A) -> Box<mem::MaybeUninit<T>, A>
496491
where
497-
A: ~const Allocator + ~const Drop + ~const Destruct,
492+
A: ~const Allocator + ~const Destruct,
498493
{
499494
let layout = Layout::new::<mem::MaybeUninit<T>>();
500495
// NOTE: Prefer match over unwrap_or_else since closure sometimes not inlineable.
@@ -530,10 +525,9 @@ impl<T, A: Allocator> Box<T, A> {
530525
#[unstable(feature = "allocator_api", issue = "32838")]
531526
// #[unstable(feature = "new_uninit", issue = "63291")]
532527
#[rustc_const_unstable(feature = "const_box", issue = "92521")]
533-
#[cfg_attr(not(bootstrap), allow(drop_bounds))] // FIXME remove `~const Drop` and this attr when bumping
534528
pub const fn try_new_zeroed_in(alloc: A) -> Result<Box<mem::MaybeUninit<T>, A>, AllocError>
535529
where
536-
A: ~const Allocator + ~const Drop + ~const Destruct,
530+
A: ~const Allocator + ~const Destruct,
537531
{
538532
let layout = Layout::new::<mem::MaybeUninit<T>>();
539533
let ptr = alloc.allocate_zeroed(layout)?.cast();
@@ -547,10 +541,9 @@ impl<T, A: Allocator> Box<T, A> {
547541
#[rustc_const_unstable(feature = "const_box", issue = "92521")]
548542
#[must_use]
549543
#[inline(always)]
550-
#[cfg_attr(not(bootstrap), allow(drop_bounds))] // FIXME remove `~const Drop` and this attr when bumping
551544
pub const fn pin_in(x: T, alloc: A) -> Pin<Self>
552545
where
553-
A: 'static + ~const Allocator + ~const Drop + ~const Destruct,
546+
A: 'static + ~const Allocator + ~const Destruct,
554547
{
555548
Self::into_pin(Self::new_in(x, alloc))
556549
}
@@ -579,10 +572,9 @@ impl<T, A: Allocator> Box<T, A> {
579572
#[unstable(feature = "box_into_inner", issue = "80437")]
580573
#[rustc_const_unstable(feature = "const_box", issue = "92521")]
581574
#[inline]
582-
#[cfg_attr(not(bootstrap), allow(drop_bounds))] // FIXME remove `~const Drop` and this attr when bumping
583575
pub const fn into_inner(boxed: Self) -> T
584576
where
585-
Self: ~const Drop + ~const Destruct,
577+
Self: ~const Destruct,
586578
{
587579
*boxed
588580
}

alloc/src/lib.rs

-1
Original file line numberDiff line numberDiff line change
@@ -141,7 +141,6 @@
141141
#![feature(box_syntax)]
142142
#![feature(cfg_sanitize)]
143143
#![feature(const_deref)]
144-
#![cfg_attr(bootstrap, feature(const_fn_trait_bound))]
145144
#![feature(const_mut_refs)]
146145
#![feature(const_ptr_write)]
147146
#![feature(const_precise_live_drops)]

alloc/src/slice.rs

+13-15
Original file line numberDiff line numberDiff line change
@@ -237,7 +237,6 @@ mod hack {
237237
}
238238
}
239239

240-
#[cfg_attr(bootstrap, lang = "slice_alloc")]
241240
#[cfg(not(test))]
242241
impl<T> [T] {
243242
/// Sorts the slice.
@@ -267,7 +266,7 @@ impl<T> [T] {
267266
/// assert!(v == [-5, -3, 1, 2, 4]);
268267
/// ```
269268
#[cfg(not(no_global_oom_handling))]
270-
#[cfg_attr(not(bootstrap), rustc_allow_incoherent_impl)]
269+
#[rustc_allow_incoherent_impl]
271270
#[stable(feature = "rust1", since = "1.0.0")]
272271
#[inline]
273272
pub fn sort(&mut self)
@@ -323,7 +322,7 @@ impl<T> [T] {
323322
/// assert!(v == [5, 4, 3, 2, 1]);
324323
/// ```
325324
#[cfg(not(no_global_oom_handling))]
326-
#[cfg_attr(not(bootstrap), rustc_allow_incoherent_impl)]
325+
#[rustc_allow_incoherent_impl]
327326
#[stable(feature = "rust1", since = "1.0.0")]
328327
#[inline]
329328
pub fn sort_by<F>(&mut self, mut compare: F)
@@ -365,7 +364,7 @@ impl<T> [T] {
365364
/// assert!(v == [1, 2, -3, 4, -5]);
366365
/// ```
367366
#[cfg(not(no_global_oom_handling))]
368-
#[cfg_attr(not(bootstrap), rustc_allow_incoherent_impl)]
367+
#[rustc_allow_incoherent_impl]
369368
#[stable(feature = "slice_sort_by_key", since = "1.7.0")]
370369
#[inline]
371370
pub fn sort_by_key<K, F>(&mut self, mut f: F)
@@ -412,7 +411,7 @@ impl<T> [T] {
412411
///
413412
/// [pdqsort]: https://github.com/orlp/pdqsort
414413
#[cfg(not(no_global_oom_handling))]
415-
#[cfg_attr(not(bootstrap), rustc_allow_incoherent_impl)]
414+
#[rustc_allow_incoherent_impl]
416415
#[stable(feature = "slice_sort_by_cached_key", since = "1.34.0")]
417416
#[inline]
418417
pub fn sort_by_cached_key<K, F>(&mut self, f: F)
@@ -471,7 +470,7 @@ impl<T> [T] {
471470
/// // Here, `s` and `x` can be modified independently.
472471
/// ```
473472
#[cfg(not(no_global_oom_handling))]
474-
#[cfg_attr(not(bootstrap), rustc_allow_incoherent_impl)]
473+
#[rustc_allow_incoherent_impl]
475474
#[rustc_conversion_suggestion]
476475
#[stable(feature = "rust1", since = "1.0.0")]
477476
#[inline]
@@ -496,7 +495,7 @@ impl<T> [T] {
496495
/// // Here, `s` and `x` can be modified independently.
497496
/// ```
498497
#[cfg(not(no_global_oom_handling))]
499-
#[cfg_attr(not(bootstrap), rustc_allow_incoherent_impl)]
498+
#[rustc_allow_incoherent_impl]
500499
#[inline]
501500
#[unstable(feature = "allocator_api", issue = "32838")]
502501
pub fn to_vec_in<A: Allocator>(&self, alloc: A) -> Vec<T, A>
@@ -521,7 +520,7 @@ impl<T> [T] {
521520
///
522521
/// assert_eq!(x, vec![10, 40, 30]);
523522
/// ```
524-
#[cfg_attr(not(bootstrap), rustc_allow_incoherent_impl)]
523+
#[rustc_allow_incoherent_impl]
525524
#[stable(feature = "rust1", since = "1.0.0")]
526525
#[inline]
527526
pub fn into_vec<A: Allocator>(self: Box<Self, A>) -> Vec<T, A> {
@@ -549,7 +548,7 @@ impl<T> [T] {
549548
/// // this will panic at runtime
550549
/// b"0123456789abcdef".repeat(usize::MAX);
551550
/// ```
552-
#[cfg_attr(not(bootstrap), rustc_allow_incoherent_impl)]
551+
#[rustc_allow_incoherent_impl]
553552
#[cfg(not(no_global_oom_handling))]
554553
#[stable(feature = "repeat_generic_slice", since = "1.40.0")]
555554
pub fn repeat(&self, n: usize) -> Vec<T>
@@ -618,7 +617,7 @@ impl<T> [T] {
618617
/// assert_eq!(["hello", "world"].concat(), "helloworld");
619618
/// assert_eq!([[1, 2], [3, 4]].concat(), [1, 2, 3, 4]);
620619
/// ```
621-
#[cfg_attr(not(bootstrap), rustc_allow_incoherent_impl)]
620+
#[rustc_allow_incoherent_impl]
622621
#[stable(feature = "rust1", since = "1.0.0")]
623622
pub fn concat<Item: ?Sized>(&self) -> <Self as Concat<Item>>::Output
624623
where
@@ -637,7 +636,7 @@ impl<T> [T] {
637636
/// assert_eq!([[1, 2], [3, 4]].join(&0), [1, 2, 0, 3, 4]);
638637
/// assert_eq!([[1, 2], [3, 4]].join(&[0, 0][..]), [1, 2, 0, 0, 3, 4]);
639638
/// ```
640-
#[cfg_attr(not(bootstrap), rustc_allow_incoherent_impl)]
639+
#[rustc_allow_incoherent_impl]
641640
#[stable(feature = "rename_connect_to_join", since = "1.3.0")]
642641
pub fn join<Separator>(&self, sep: Separator) -> <Self as Join<Separator>>::Output
643642
where
@@ -656,7 +655,7 @@ impl<T> [T] {
656655
/// assert_eq!(["hello", "world"].connect(" "), "hello world");
657656
/// assert_eq!([[1, 2], [3, 4]].connect(&0), [1, 2, 0, 3, 4]);
658657
/// ```
659-
#[cfg_attr(not(bootstrap), rustc_allow_incoherent_impl)]
658+
#[rustc_allow_incoherent_impl]
660659
#[stable(feature = "rust1", since = "1.0.0")]
661660
#[rustc_deprecated(since = "1.3.0", reason = "renamed to join")]
662661
pub fn connect<Separator>(&self, sep: Separator) -> <Self as Join<Separator>>::Output
@@ -667,7 +666,6 @@ impl<T> [T] {
667666
}
668667
}
669668

670-
#[cfg_attr(bootstrap, lang = "slice_u8_alloc")]
671669
#[cfg(not(test))]
672670
impl [u8] {
673671
/// Returns a vector containing a copy of this slice where each byte
@@ -680,7 +678,7 @@ impl [u8] {
680678
///
681679
/// [`make_ascii_uppercase`]: slice::make_ascii_uppercase
682680
#[cfg(not(no_global_oom_handling))]
683-
#[cfg_attr(not(bootstrap), rustc_allow_incoherent_impl)]
681+
#[rustc_allow_incoherent_impl]
684682
#[must_use = "this returns the uppercase bytes as a new Vec, \
685683
without modifying the original"]
686684
#[stable(feature = "ascii_methods_on_intrinsics", since = "1.23.0")]
@@ -701,7 +699,7 @@ impl [u8] {
701699
///
702700
/// [`make_ascii_lowercase`]: slice::make_ascii_lowercase
703701
#[cfg(not(no_global_oom_handling))]
704-
#[cfg_attr(not(bootstrap), rustc_allow_incoherent_impl)]
702+
#[rustc_allow_incoherent_impl]
705703
#[must_use = "this returns the lowercase bytes as a new Vec, \
706704
without modifying the original"]
707705
#[stable(feature = "ascii_methods_on_intrinsics", since = "1.23.0")]

alloc/src/str.rs

+9-10
Original file line numberDiff line numberDiff line change
@@ -235,7 +235,6 @@ impl ToOwned for str {
235235
}
236236

237237
/// Methods for string slices.
238-
#[cfg_attr(bootstrap, lang = "str_alloc")]
239238
#[cfg(not(test))]
240239
impl str {
241240
/// Converts a `Box<str>` into a `Box<[u8]>` without copying or allocating.
@@ -250,7 +249,7 @@ impl str {
250249
/// let boxed_bytes = boxed_str.into_boxed_bytes();
251250
/// assert_eq!(*boxed_bytes, *s.as_bytes());
252251
/// ```
253-
#[cfg_attr(not(bootstrap), rustc_allow_incoherent_impl)]
252+
#[rustc_allow_incoherent_impl]
254253
#[stable(feature = "str_box_extras", since = "1.20.0")]
255254
#[must_use = "`self` will be dropped if the result is not used"]
256255
#[inline]
@@ -281,7 +280,7 @@ impl str {
281280
/// assert_eq!(s, s.replace("cookie monster", "little lamb"));
282281
/// ```
283282
#[cfg(not(no_global_oom_handling))]
284-
#[cfg_attr(not(bootstrap), rustc_allow_incoherent_impl)]
283+
#[rustc_allow_incoherent_impl]
285284
#[must_use = "this returns the replaced string as a new allocation, \
286285
without modifying the original"]
287286
#[stable(feature = "rust1", since = "1.0.0")]
@@ -322,7 +321,7 @@ impl str {
322321
/// assert_eq!(s, s.replacen("cookie monster", "little lamb", 10));
323322
/// ```
324323
#[cfg(not(no_global_oom_handling))]
325-
#[cfg_attr(not(bootstrap), rustc_allow_incoherent_impl)]
324+
#[rustc_allow_incoherent_impl]
326325
#[must_use = "this returns the replaced string as a new allocation, \
327326
without modifying the original"]
328327
#[stable(feature = "str_replacen", since = "1.16.0")]
@@ -379,7 +378,7 @@ impl str {
379378
/// assert_eq!(new_year, new_year.to_lowercase());
380379
/// ```
381380
#[cfg(not(no_global_oom_handling))]
382-
#[cfg_attr(not(bootstrap), rustc_allow_incoherent_impl)]
381+
#[rustc_allow_incoherent_impl]
383382
#[must_use = "this returns the lowercase string as a new String, \
384383
without modifying the original"]
385384
#[stable(feature = "unicode_case_mapping", since = "1.2.0")]
@@ -462,7 +461,7 @@ impl str {
462461
/// assert_eq!("TSCHÜSS", s.to_uppercase());
463462
/// ```
464463
#[cfg(not(no_global_oom_handling))]
465-
#[cfg_attr(not(bootstrap), rustc_allow_incoherent_impl)]
464+
#[rustc_allow_incoherent_impl]
466465
#[must_use = "this returns the uppercase string as a new String, \
467466
without modifying the original"]
468467
#[stable(feature = "unicode_case_mapping", since = "1.2.0")]
@@ -498,7 +497,7 @@ impl str {
498497
/// assert_eq!(boxed_str.into_string(), string);
499498
/// ```
500499
#[stable(feature = "box_str", since = "1.4.0")]
501-
#[cfg_attr(not(bootstrap), rustc_allow_incoherent_impl)]
500+
#[rustc_allow_incoherent_impl]
502501
#[must_use = "`self` will be dropped if the result is not used"]
503502
#[inline]
504503
pub fn into_string(self: Box<str>) -> String {
@@ -527,7 +526,7 @@ impl str {
527526
/// let huge = "0123456789abcdef".repeat(usize::MAX);
528527
/// ```
529528
#[cfg(not(no_global_oom_handling))]
530-
#[cfg_attr(not(bootstrap), rustc_allow_incoherent_impl)]
529+
#[rustc_allow_incoherent_impl]
531530
#[must_use]
532531
#[stable(feature = "repeat_str", since = "1.16.0")]
533532
pub fn repeat(&self, n: usize) -> String {
@@ -556,7 +555,7 @@ impl str {
556555
/// [`make_ascii_uppercase`]: str::make_ascii_uppercase
557556
/// [`to_uppercase`]: #method.to_uppercase
558557
#[cfg(not(no_global_oom_handling))]
559-
#[cfg_attr(not(bootstrap), rustc_allow_incoherent_impl)]
558+
#[rustc_allow_incoherent_impl]
560559
#[must_use = "to uppercase the value in-place, use `make_ascii_uppercase()`"]
561560
#[stable(feature = "ascii_methods_on_intrinsics", since = "1.23.0")]
562561
#[inline]
@@ -589,7 +588,7 @@ impl str {
589588
/// [`make_ascii_lowercase`]: str::make_ascii_lowercase
590589
/// [`to_lowercase`]: #method.to_lowercase
591590
#[cfg(not(no_global_oom_handling))]
592-
#[cfg_attr(not(bootstrap), rustc_allow_incoherent_impl)]
591+
#[rustc_allow_incoherent_impl]
593592
#[must_use = "to lowercase the value in-place, use `make_ascii_lowercase()`"]
594593
#[stable(feature = "ascii_methods_on_intrinsics", since = "1.23.0")]
595594
#[inline]

core/src/array/mod.rs

-1
Original file line numberDiff line numberDiff line change
@@ -395,7 +395,6 @@ macro_rules! array_impl_default {
395395

396396
array_impl_default! {32, T T T T T T T T T T T T T T T T T T T T T T T T T T T T T T T T}
397397

398-
#[cfg_attr(bootstrap, lang = "array")]
399398
impl<T, const N: usize> [T; N] {
400399
/// Returns an array of the same size as `self`, with function `f` applied to each element
401400
/// in order.

core/src/bool.rs

+2-5
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,6 @@
22
33
use crate::marker::Destruct;
44

5-
#[cfg_attr(bootstrap, lang = "bool")]
65
impl bool {
76
/// Returns `Some(t)` if the `bool` is [`true`](../std/keyword.true.html),
87
/// or `None` otherwise.
@@ -18,10 +17,9 @@ impl bool {
1817
#[unstable(feature = "bool_to_option", issue = "80967")]
1918
#[rustc_const_unstable(feature = "const_bool_to_option", issue = "91917")]
2019
#[inline]
21-
#[cfg_attr(not(bootstrap), allow(drop_bounds))] // FIXME remove `~const Drop` and this attr when bumping
2220
pub const fn then_some<T>(self, t: T) -> Option<T>
2321
where
24-
T: ~const Drop + ~const Destruct,
22+
T: ~const Destruct,
2523
{
2624
if self { Some(t) } else { None }
2725
}
@@ -38,11 +36,10 @@ impl bool {
3836
#[stable(feature = "lazy_bool_to_option", since = "1.50.0")]
3937
#[rustc_const_unstable(feature = "const_bool_to_option", issue = "91917")]
4038
#[inline]
41-
#[cfg_attr(not(bootstrap), allow(drop_bounds))] // FIXME remove `~const Drop` and this attr when bumping
4239
pub const fn then<T, F>(self, f: F) -> Option<T>
4340
where
4441
F: ~const FnOnce() -> T,
45-
F: ~const Drop + ~const Destruct,
42+
F: ~const Destruct,
4643
{
4744
if self { Some(f()) } else { None }
4845
}

0 commit comments

Comments
 (0)