diff --git a/compiler/rustc_codegen_llvm/src/lib.rs b/compiler/rustc_codegen_llvm/src/lib.rs index 552a91ffee071..99d5f64f49d6a 100644 --- a/compiler/rustc_codegen_llvm/src/lib.rs +++ b/compiler/rustc_codegen_llvm/src/lib.rs @@ -5,13 +5,13 @@ //! This API is completely unstable and subject to change. // tidy-alphabetical-start +#![cfg_attr(bootstrap, feature(trim_prefix_suffix))] #![feature(extern_types)] #![feature(file_buffered)] #![feature(impl_trait_in_assoc_type)] #![feature(iter_intersperse)] #![feature(macro_derive)] #![feature(once_cell_try)] -#![feature(trim_prefix_suffix)] #![feature(try_blocks)] // tidy-alphabetical-end diff --git a/compiler/rustc_driver_impl/src/lib.rs b/compiler/rustc_driver_impl/src/lib.rs index 54a1babbaae72..45298ff82f6a5 100644 --- a/compiler/rustc_driver_impl/src/lib.rs +++ b/compiler/rustc_driver_impl/src/lib.rs @@ -5,11 +5,11 @@ //! This API is completely unstable and subject to change. // tidy-alphabetical-start +#![cfg_attr(bootstrap, feature(trim_prefix_suffix))] #![feature(decl_macro)] #![feature(file_buffered)] #![feature(panic_backtrace_config)] #![feature(panic_update_hook)] -#![feature(trim_prefix_suffix)] #![feature(try_blocks)] // tidy-alphabetical-end diff --git a/compiler/rustc_hir_typeck/src/lib.rs b/compiler/rustc_hir_typeck/src/lib.rs index 57fd6a8658ae3..f1f81e1f0723c 100644 --- a/compiler/rustc_hir_typeck/src/lib.rs +++ b/compiler/rustc_hir_typeck/src/lib.rs @@ -1,11 +1,11 @@ // tidy-alphabetical-start #![cfg_attr(bootstrap, feature(never_type))] +#![cfg_attr(bootstrap, feature(trim_prefix_suffix))] #![feature(deref_patterns)] #![feature(iter_intersperse)] #![feature(iter_order_by)] #![feature(option_into_flat_iter)] #![feature(option_reference_flattening)] -#![feature(trim_prefix_suffix)] // tidy-alphabetical-end mod _match; diff --git a/compiler/rustc_resolve/src/lib.rs b/compiler/rustc_resolve/src/lib.rs index 2b1c0bf80a694..ec61385fd1855 100644 --- a/compiler/rustc_resolve/src/lib.rs +++ b/compiler/rustc_resolve/src/lib.rs @@ -8,6 +8,7 @@ // tidy-alphabetical-start #![allow(internal_features)] +#![cfg_attr(bootstrap, feature(trim_prefix_suffix))] #![feature(arbitrary_self_types)] #![feature(const_default)] #![feature(const_trait_impl)] @@ -17,7 +18,6 @@ #![feature(iter_intersperse)] #![feature(option_into_flat_iter)] #![feature(rustc_attrs)] -#![feature(trim_prefix_suffix)] #![recursion_limit = "256"] // tidy-alphabetical-end diff --git a/library/core/src/slice/mod.rs b/library/core/src/slice/mod.rs index f73f0c5390629..97fdf93f592b0 100644 --- a/library/core/src/slice/mod.rs +++ b/library/core/src/slice/mod.rs @@ -2784,8 +2784,6 @@ impl [T] { /// # Examples /// /// ``` - /// #![feature(trim_prefix_suffix)] - /// /// let v = &[10, 40, 30]; /// /// // Prefix present - removes it @@ -2801,7 +2799,7 @@ impl [T] { /// assert_eq!(b"hello".trim_prefix(prefix.as_bytes()), b"llo".as_ref()); /// ``` #[must_use = "returns the subslice without modifying the original"] - #[unstable(feature = "trim_prefix_suffix", issue = "142312")] + #[stable(feature = "trim_prefix_suffix", since = "CURRENT_RUSTC_VERSION")] pub fn trim_prefix + ?Sized>(&self, prefix: &P) -> &[T] where T: PartialEq, @@ -2827,8 +2825,6 @@ impl [T] { /// # Examples /// /// ``` - /// #![feature(trim_prefix_suffix)] - /// /// let v = &[10, 40, 30]; /// /// // Suffix present - removes it @@ -2841,7 +2837,7 @@ impl [T] { /// assert_eq!(v.trim_suffix(&[50, 30]), &[10, 40, 30][..]); /// ``` #[must_use = "returns the subslice without modifying the original"] - #[unstable(feature = "trim_prefix_suffix", issue = "142312")] + #[stable(feature = "trim_prefix_suffix", since = "CURRENT_RUSTC_VERSION")] pub fn trim_suffix + ?Sized>(&self, suffix: &P) -> &[T] where T: PartialEq, diff --git a/library/core/src/str/mod.rs b/library/core/src/str/mod.rs index 79f4f29da2d43..70842f2d88554 100644 --- a/library/core/src/str/mod.rs +++ b/library/core/src/str/mod.rs @@ -2546,8 +2546,6 @@ impl str { /// # Examples /// /// ``` - /// #![feature(trim_prefix_suffix)] - /// /// // Prefix present - removes it /// assert_eq!("foo:bar".trim_prefix("foo:"), "bar"); /// assert_eq!("foofoo".trim_prefix("foo"), "foo"); @@ -2560,7 +2558,7 @@ impl str { /// ``` #[must_use = "this returns the remaining substring as a new slice, \ without modifying the original"] - #[unstable(feature = "trim_prefix_suffix", issue = "142312")] + #[stable(feature = "trim_prefix_suffix", since = "CURRENT_RUSTC_VERSION")] pub fn trim_prefix(&self, prefix: P) -> &str { prefix.strip_prefix_of(self).unwrap_or(self) } @@ -2583,8 +2581,6 @@ impl str { /// # Examples /// /// ``` - /// #![feature(trim_prefix_suffix)] - /// /// // Suffix present - removes it /// assert_eq!("bar:foo".trim_suffix(":foo"), "bar"); /// assert_eq!("foofoo".trim_suffix("foo"), "foo"); @@ -2597,7 +2593,7 @@ impl str { /// ``` #[must_use = "this returns the remaining substring as a new slice, \ without modifying the original"] - #[unstable(feature = "trim_prefix_suffix", issue = "142312")] + #[stable(feature = "trim_prefix_suffix", since = "CURRENT_RUSTC_VERSION")] pub fn trim_suffix(&self, suffix: P) -> &str where for<'a> P::Searcher<'a>: ReverseSearcher<'a>, diff --git a/library/std/src/path.rs b/library/std/src/path.rs index 3052587389a91..79b97e38911d3 100644 --- a/library/std/src/path.rs +++ b/library/std/src/path.rs @@ -2752,7 +2752,6 @@ impl Path { /// # Examples /// /// ``` - /// #![feature(trim_prefix_suffix)] /// use std::path::Path; /// /// let path = Path::new("/test/haha/foo.txt"); @@ -2770,7 +2769,7 @@ impl Path { /// assert_eq!(path.trim_prefix("/haha"), path); /// ``` #[must_use = "this returns the remaining path as a new path, without modifying the original"] - #[unstable(feature = "trim_prefix_suffix", issue = "142312")] + #[stable(feature = "trim_prefix_suffix", since = "CURRENT_RUSTC_VERSION")] pub fn trim_prefix

(&self, base: P) -> &Path where P: AsRef, diff --git a/src/librustdoc/lib.rs b/src/librustdoc/lib.rs index c4f7d2c361952..6feb338793b05 100644 --- a/src/librustdoc/lib.rs +++ b/src/librustdoc/lib.rs @@ -1,4 +1,5 @@ // tidy-alphabetical-start +#![cfg_attr(bootstrap, feature(trim_prefix_suffix))] #![doc( html_root_url = "https://doc.rust-lang.org/nightly/", html_playground_url = "https://play.rust-lang.org/" @@ -12,7 +13,6 @@ #![feature(iter_order_by)] #![feature(rustc_private)] #![feature(test)] -#![feature(trim_prefix_suffix)] #![feature(variant_count)] #![recursion_limit = "256"] #![warn(rustc::internal)]