diff options
| author | Pietro Albini <pietro@pietroalbini.org> | 2022-04-05 22:42:23 +0200 |
|---|---|---|
| committer | Pietro Albini <pietro@pietroalbini.org> | 2022-04-05 23:18:40 +0200 |
| commit | 181d28bb6110dc974879db20d433f21aa142db3a (patch) | |
| tree | 3bbc185fd9386b9cc050235fd1785820fcaaae5c /library/alloc/src | |
| parent | e96538aeeb2a71e672e1d1a40dcaf0ad34a826b5 (diff) | |
| download | rust-181d28bb6110dc974879db20d433f21aa142db3a.tar.gz rust-181d28bb6110dc974879db20d433f21aa142db3a.zip | |
trivial cfg(bootstrap) changes
Diffstat (limited to 'library/alloc/src')
| -rw-r--r-- | library/alloc/src/alloc.rs | 6 | ||||
| -rw-r--r-- | library/alloc/src/borrow.rs | 1 | ||||
| -rw-r--r-- | library/alloc/src/boxed.rs | 26 | ||||
| -rw-r--r-- | library/alloc/src/lib.rs | 1 | ||||
| -rw-r--r-- | library/alloc/src/slice.rs | 28 | ||||
| -rw-r--r-- | library/alloc/src/str.rs | 19 |
6 files changed, 32 insertions, 49 deletions
diff --git a/library/alloc/src/alloc.rs b/library/alloc/src/alloc.rs index 44389ee47b0..39f8f1d5a0e 100644 --- a/library/alloc/src/alloc.rs +++ b/library/alloc/src/alloc.rs @@ -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, ) { diff --git a/library/alloc/src/borrow.rs b/library/alloc/src/borrow.rs index 27e5af4f1be..8b13e36c4b3 100644 --- a/library/alloc/src/borrow.rs +++ b/library/alloc/src/borrow.rs @@ -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>, diff --git a/library/alloc/src/boxed.rs b/library/alloc/src/boxed.rs index b5f4c9a237b..a56d4de03cd 100644 --- a/library/alloc/src/boxed.rs +++ b/library/alloc/src/boxed.rs @@ -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 { @@ -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 { @@ -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. @@ -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(); @@ -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. @@ -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(); @@ -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)) } @@ -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 } diff --git a/library/alloc/src/lib.rs b/library/alloc/src/lib.rs index 065d071a2e3..72d6c267290 100644 --- a/library/alloc/src/lib.rs +++ b/library/alloc/src/lib.rs @@ -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)] diff --git a/library/alloc/src/slice.rs b/library/alloc/src/slice.rs index 89d85146963..31edbe0c5af 100644 --- a/library/alloc/src/slice.rs +++ b/library/alloc/src/slice.rs @@ -237,7 +237,6 @@ mod hack { } } -#[cfg_attr(bootstrap, lang = "slice_alloc")] #[cfg(not(test))] impl<T> [T] { /// Sorts the slice. @@ -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) @@ -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) @@ -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) @@ -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) @@ -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] @@ -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> @@ -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> { @@ -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> @@ -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 @@ -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 @@ -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 @@ -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 @@ -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")] @@ -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")] diff --git a/library/alloc/src/str.rs b/library/alloc/src/str.rs index a3c17612c3a..0eaa2639863 100644 --- a/library/alloc/src/str.rs +++ b/library/alloc/src/str.rs @@ -235,7 +235,6 @@ impl ToOwned for str { } /// Methods for string slices. -#[cfg_attr(bootstrap, lang = "str_alloc")] #[cfg(not(test))] impl str { /// Converts a `Box<str>` into a `Box<[u8]>` without copying or allocating. @@ -250,7 +249,7 @@ impl str { /// let boxed_bytes = boxed_str.into_boxed_bytes(); /// assert_eq!(*boxed_bytes, *s.as_bytes()); /// ``` - #[cfg_attr(not(bootstrap), rustc_allow_incoherent_impl)] + #[rustc_allow_incoherent_impl] #[stable(feature = "str_box_extras", since = "1.20.0")] #[must_use = "`self` will be dropped if the result is not used"] #[inline] @@ -281,7 +280,7 @@ impl str { /// assert_eq!(s, s.replace("cookie monster", "little lamb")); /// ``` #[cfg(not(no_global_oom_handling))] - #[cfg_attr(not(bootstrap), rustc_allow_incoherent_impl)] + #[rustc_allow_incoherent_impl] #[must_use = "this returns the replaced string as a new allocation, \ without modifying the original"] #[stable(feature = "rust1", since = "1.0.0")] @@ -322,7 +321,7 @@ impl str { /// assert_eq!(s, s.replacen("cookie monster", "little lamb", 10)); /// ``` #[cfg(not(no_global_oom_handling))] - #[cfg_attr(not(bootstrap), rustc_allow_incoherent_impl)] + #[rustc_allow_incoherent_impl] #[must_use = "this returns the replaced string as a new allocation, \ without modifying the original"] #[stable(feature = "str_replacen", since = "1.16.0")] @@ -379,7 +378,7 @@ impl str { /// assert_eq!(new_year, new_year.to_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 string as a new String, \ without modifying the original"] #[stable(feature = "unicode_case_mapping", since = "1.2.0")] @@ -462,7 +461,7 @@ impl str { /// assert_eq!("TSCHÜSS", s.to_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 string as a new String, \ without modifying the original"] #[stable(feature = "unicode_case_mapping", since = "1.2.0")] @@ -498,7 +497,7 @@ impl str { /// assert_eq!(boxed_str.into_string(), string); /// ``` #[stable(feature = "box_str", since = "1.4.0")] - #[cfg_attr(not(bootstrap), rustc_allow_incoherent_impl)] + #[rustc_allow_incoherent_impl] #[must_use = "`self` will be dropped if the result is not used"] #[inline] pub fn into_string(self: Box<str>) -> String { @@ -527,7 +526,7 @@ impl str { /// let huge = "0123456789abcdef".repeat(usize::MAX); /// ``` #[cfg(not(no_global_oom_handling))] - #[cfg_attr(not(bootstrap), rustc_allow_incoherent_impl)] + #[rustc_allow_incoherent_impl] #[must_use] #[stable(feature = "repeat_str", since = "1.16.0")] pub fn repeat(&self, n: usize) -> String { @@ -556,7 +555,7 @@ impl str { /// [`make_ascii_uppercase`]: str::make_ascii_uppercase /// [`to_uppercase`]: #method.to_uppercase #[cfg(not(no_global_oom_handling))] - #[cfg_attr(not(bootstrap), rustc_allow_incoherent_impl)] + #[rustc_allow_incoherent_impl] #[must_use = "to uppercase the value in-place, use `make_ascii_uppercase()`"] #[stable(feature = "ascii_methods_on_intrinsics", since = "1.23.0")] #[inline] @@ -589,7 +588,7 @@ impl str { /// [`make_ascii_lowercase`]: str::make_ascii_lowercase /// [`to_lowercase`]: #method.to_lowercase #[cfg(not(no_global_oom_handling))] - #[cfg_attr(not(bootstrap), rustc_allow_incoherent_impl)] + #[rustc_allow_incoherent_impl] #[must_use = "to lowercase the value in-place, use `make_ascii_lowercase()`"] #[stable(feature = "ascii_methods_on_intrinsics", since = "1.23.0")] #[inline] |
