diff --git a/compiler/rustc_codegen_llvm/src/lib.rs b/compiler/rustc_codegen_llvm/src/lib.rs index ddc5db619ea5f..64ebe901dc3ef 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 5af05fa6fe0fd..697bf2d528036 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 0f977710fbe09..1028f097fa693 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 ce03e1a70399c..215ac574ed6b2 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 f787b7994ba9d..4f886eb68b24b 100644 --- a/library/core/src/slice/mod.rs +++ b/library/core/src/slice/mod.rs @@ -2786,8 +2786,6 @@ impl [T] { /// # Examples /// /// ``` - /// #![feature(trim_prefix_suffix)] - /// /// let v = &[10, 40, 30]; /// /// // Prefix present - removes it @@ -2803,7 +2801,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, @@ -2829,8 +2827,6 @@ impl [T] { /// # Examples /// /// ``` - /// #![feature(trim_prefix_suffix)] - /// /// let v = &[10, 40, 30]; /// /// // Suffix present - removes it @@ -2843,7 +2839,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 fe58d848e67c2..db52d3bada4c8 100644 --- a/library/core/src/str/mod.rs +++ b/library/core/src/str/mod.rs @@ -2545,8 +2545,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"); @@ -2559,7 +2557,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) } @@ -2582,8 +2580,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"); @@ -2596,7 +2592,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/lib.rs b/library/std/src/lib.rs index 5f98aa54a6620..3f853df52bc53 100644 --- a/library/std/src/lib.rs +++ b/library/std/src/lib.rs @@ -390,7 +390,6 @@ #![feature(str_internals)] #![feature(sync_unsafe_cell)] #![feature(temporary_niche_types)] -#![feature(trim_prefix_suffix)] #![feature(ub_checks)] #![feature(uint_carryless_mul)] #![feature(unsafe_pinned)] diff --git a/library/std/src/path.rs b/library/std/src/path.rs index f06625613ec00..fe72ad4692c02 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 20e992945c917..24427ff5cb3d3 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))] #![cfg_attr(not(bootstrap), feature(exitcode_exit_method))] #![doc( html_root_url = "https://doc.rust-lang.org/nightly/", @@ -14,7 +15,6 @@ #![feature(iter_partition_in_place)] #![feature(rustc_private)] #![feature(test)] -#![feature(trim_prefix_suffix)] #![feature(variant_count)] #![recursion_limit = "256"] #![warn(rustc::internal)]