X-Git-Url: https://git.lizzy.rs/?a=blobdiff_plain;f=library%2Falloc%2Fsrc%2Fslice.rs;h=02a47c57b8ae3bcec2a7c27e8018b1d922d53543;hb=c5f2c4476e1c72315e7bf405a2e15b5c9489c001;hp=89d85146963cfa52b63011e8b04d131337dd3934;hpb=c5e7e952925be74fc7dd6a2fac8e16df9e2044f6;p=rust.git diff --git a/library/alloc/src/slice.rs b/library/alloc/src/slice.rs index 89d85146963..5bdf36a63a2 100644 --- a/library/alloc/src/slice.rs +++ b/library/alloc/src/slice.rs @@ -153,7 +153,7 @@ // functions are actually methods that are in `impl [T]` but not in // `core::slice::SliceExt` - we need to supply these functions for the // `test_permutations` test -mod hack { +pub(crate) mod hack { use core::alloc::Allocator; use crate::boxed::Box; @@ -237,7 +237,6 @@ fn to_vec(s: &[Self], alloc: A) -> Vec { } } -#[cfg_attr(bootstrap, lang = "slice_alloc")] #[cfg(not(test))] impl [T] { /// Sorts the slice. @@ -267,7 +266,7 @@ impl [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 @@ pub fn sort(&mut self) /// 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(&mut self, mut compare: F) @@ -365,7 +364,7 @@ pub fn sort_by(&mut self, mut compare: F) /// 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(&mut self, mut f: F) @@ -412,7 +411,7 @@ pub fn sort_by_key(&mut self, mut f: F) /// /// [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(&mut self, f: F) @@ -471,7 +470,7 @@ macro_rules! sort_by_key { /// // 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 @@ pub fn to_vec(&self) -> Vec /// // 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(&self, alloc: A) -> Vec @@ -521,7 +520,7 @@ pub fn to_vec_in(&self, alloc: A) -> Vec /// /// 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(self: Box) -> Vec { @@ -549,7 +548,7 @@ pub fn into_vec(self: Box) -> Vec { /// // 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 @@ -618,7 +617,7 @@ pub fn repeat(&self, n: usize) -> Vec /// 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(&self) -> >::Output where @@ -637,7 +636,7 @@ pub fn concat(&self) -> >::Output /// 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(&self, sep: Separator) -> >::Output where @@ -656,9 +655,9 @@ pub fn join(&self, sep: Separator) -> >::Outp /// 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")] + #[deprecated(since = "1.3.0", note = "renamed to join")] pub fn connect(&self, sep: Separator) -> >::Output where Self: Join, @@ -667,7 +666,6 @@ pub fn connect(&self, sep: Separator) -> >::O } } -#[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 @@ pub fn to_ascii_uppercase(&self) -> Vec { /// /// [`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")]