diff --git a/compiler/rustc_codegen_cranelift/example/std_example.rs b/compiler/rustc_codegen_cranelift/example/std_example.rs
index 6cedd84adfe..e99763e2722 100644
--- a/compiler/rustc_codegen_cranelift/example/std_example.rs
+++ b/compiler/rustc_codegen_cranelift/example/std_example.rs
@@ -3,7 +3,6 @@
coroutines,
stmt_expr_attributes,
coroutine_trait,
- is_sorted,
repr_simd,
tuple_trait,
unboxed_closures
diff --git a/compiler/rustc_codegen_gcc/example/std_example.rs b/compiler/rustc_codegen_gcc/example/std_example.rs
index 8ab8fcc525e..9e43b4635f0 100644
--- a/compiler/rustc_codegen_gcc/example/std_example.rs
+++ b/compiler/rustc_codegen_gcc/example/std_example.rs
@@ -1,5 +1,5 @@
#![allow(internal_features)]
-#![feature(core_intrinsics, coroutines, coroutine_trait, is_sorted, stmt_expr_attributes)]
+#![feature(core_intrinsics, coroutines, coroutine_trait, stmt_expr_attributes)]
#[cfg(feature="master")]
#[cfg(target_arch="x86_64")]
diff --git a/compiler/rustc_hir_analysis/src/lib.rs b/compiler/rustc_hir_analysis/src/lib.rs
index dd7fbba753b..89b981ab80d 100644
--- a/compiler/rustc_hir_analysis/src/lib.rs
+++ b/compiler/rustc_hir_analysis/src/lib.rs
@@ -64,7 +64,6 @@ This API is completely unstable and subject to change.
#![doc(rust_logo)]
#![feature(control_flow_enum)]
#![feature(if_let_guard)]
-#![feature(is_sorted)]
#![feature(iter_intersperse)]
#![feature(let_chains)]
#![feature(never_type)]
diff --git a/compiler/rustc_lint_defs/src/builtin.rs b/compiler/rustc_lint_defs/src/builtin.rs
index 5d4cc7561a6..c4158cccca4 100644
--- a/compiler/rustc_lint_defs/src/builtin.rs
+++ b/compiler/rustc_lint_defs/src/builtin.rs
@@ -1984,14 +1984,18 @@ declare_lint! {
///
/// ```rust
/// trait MyIterator : Iterator {
- /// // is_sorted is an unstable method that already exists on the Iterator trait
- /// fn is_sorted(self) -> bool where Self: Sized {true}
+ /// // is_partitioned is an unstable method that already exists on the Iterator trait
+ /// fn is_partitioned
(self, predicate: P) -> bool
+ /// where
+ /// Self: Sized,
+ /// P: FnMut(Self::Item) -> bool,
+ /// {true}
/// }
///
/// impl MyIterator for T where T: Iterator { }
///
/// let x = vec![1, 2, 3];
- /// let _ = x.iter().is_sorted();
+ /// let _ = x.iter().is_partitioned(|_| true);
/// ```
///
/// {{produces}}
@@ -2007,7 +2011,7 @@ declare_lint! {
/// is an early-warning to let you know that there may be a collision in
/// the future. This can be avoided by adding type annotations to
/// disambiguate which trait method you intend to call, such as
- /// `MyIterator::is_sorted(my_iter)` or renaming or removing the method.
+ /// `MyIterator::is_partitioned(my_iter, my_predicate)` or renaming or removing the method.
///
/// [nightly channel]: https://doc.rust-lang.org/book/appendix-07-nightly-rust.html
/// [`feature` attribute]: https://doc.rust-lang.org/nightly/unstable-book/
diff --git a/compiler/rustc_mir_transform/src/lib.rs b/compiler/rustc_mir_transform/src/lib.rs
index 5d253d7384d..243c9c6a2fd 100644
--- a/compiler/rustc_mir_transform/src/lib.rs
+++ b/compiler/rustc_mir_transform/src/lib.rs
@@ -6,7 +6,6 @@
#![feature(decl_macro)]
#![feature(if_let_guard)]
#![feature(impl_trait_in_assoc_type)]
-#![feature(is_sorted)]
#![feature(let_chains)]
#![feature(map_try_insert)]
#![feature(never_type)]
diff --git a/compiler/rustc_monomorphize/src/lib.rs b/compiler/rustc_monomorphize/src/lib.rs
index fc6e8e0d14f..3b8f0a91e74 100644
--- a/compiler/rustc_monomorphize/src/lib.rs
+++ b/compiler/rustc_monomorphize/src/lib.rs
@@ -1,6 +1,5 @@
// tidy-alphabetical-start
#![feature(array_windows)]
-#![feature(is_sorted)]
// tidy-alphabetical-end
use rustc_hir::lang_items::LangItem;
diff --git a/library/alloc/src/lib.rs b/library/alloc/src/lib.rs
index 4491a717dc2..49036077e2e 100644
--- a/library/alloc/src/lib.rs
+++ b/library/alloc/src/lib.rs
@@ -92,7 +92,6 @@
// tidy-alphabetical-start
#![cfg_attr(not(no_global_oom_handling), feature(const_alloc_error))]
#![cfg_attr(not(no_global_oom_handling), feature(const_btree_len))]
-#![cfg_attr(test, feature(is_sorted))]
#![cfg_attr(test, feature(new_uninit))]
#![feature(alloc_layout_extra)]
#![feature(allocator_api)]
diff --git a/library/core/src/iter/traits/iterator.rs b/library/core/src/iter/traits/iterator.rs
index 469097e4847..c85a61ada3d 100644
--- a/library/core/src/iter/traits/iterator.rs
+++ b/library/core/src/iter/traits/iterator.rs
@@ -3951,8 +3951,6 @@ pub trait Iterator {
/// # Examples
///
/// ```
- /// #![feature(is_sorted)]
- ///
/// assert!([1, 2, 2, 9].iter().is_sorted());
/// assert!(![1, 3, 2, 4].iter().is_sorted());
/// assert!([0].iter().is_sorted());
@@ -3960,7 +3958,7 @@ pub trait Iterator {
/// assert!(![0.0, 1.0, f32::NAN].iter().is_sorted());
/// ```
#[inline]
- #[unstable(feature = "is_sorted", reason = "new API", issue = "53485")]
+ #[stable(feature = "is_sorted", since = "CURRENT_RUSTC_VERSION")]
#[rustc_do_not_const_check]
fn is_sorted(self) -> bool
where
@@ -3978,8 +3976,6 @@ pub trait Iterator {
/// # Examples
///
/// ```
- /// #![feature(is_sorted)]
- ///
/// assert!([1, 2, 2, 9].iter().is_sorted_by(|a, b| a <= b));
/// assert!(![1, 2, 2, 9].iter().is_sorted_by(|a, b| a < b));
///
@@ -3989,7 +3985,7 @@ pub trait Iterator {
/// assert!(std::iter::empty::().is_sorted_by(|a, b| false));
/// assert!(std::iter::empty::().is_sorted_by(|a, b| true));
/// ```
- #[unstable(feature = "is_sorted", reason = "new API", issue = "53485")]
+ #[stable(feature = "is_sorted", since = "CURRENT_RUSTC_VERSION")]
#[rustc_do_not_const_check]
fn is_sorted_by(mut self, compare: F) -> bool
where
@@ -4030,13 +4026,11 @@ pub trait Iterator {
/// # Examples
///
/// ```
- /// #![feature(is_sorted)]
- ///
/// assert!(["c", "bb", "aaa"].iter().is_sorted_by_key(|s| s.len()));
/// assert!(![-2i32, -1, 0, 3].iter().is_sorted_by_key(|n| n.abs()));
/// ```
#[inline]
- #[unstable(feature = "is_sorted", reason = "new API", issue = "53485")]
+ #[stable(feature = "is_sorted", since = "CURRENT_RUSTC_VERSION")]
#[rustc_do_not_const_check]
fn is_sorted_by_key(self, f: F) -> bool
where
diff --git a/library/core/src/slice/mod.rs b/library/core/src/slice/mod.rs
index 6d3e625bef4..201e1284b70 100644
--- a/library/core/src/slice/mod.rs
+++ b/library/core/src/slice/mod.rs
@@ -4069,7 +4069,6 @@ impl [T] {
/// # Examples
///
/// ```
- /// #![feature(is_sorted)]
/// let empty: [i32; 0] = [];
///
/// assert!([1, 2, 2, 9].is_sorted());
@@ -4079,7 +4078,7 @@ impl [T] {
/// assert!(![0.0, 1.0, f32::NAN].is_sorted());
/// ```
#[inline]
- #[unstable(feature = "is_sorted", reason = "new API", issue = "53485")]
+ #[stable(feature = "is_sorted", since = "CURRENT_RUSTC_VERSION")]
#[must_use]
pub fn is_sorted(&self) -> bool
where
@@ -4096,8 +4095,6 @@ impl [T] {
/// # Examples
///
/// ```
- /// #![feature(is_sorted)]
- ///
/// assert!([1, 2, 2, 9].is_sorted_by(|a, b| a <= b));
/// assert!(![1, 2, 2, 9].is_sorted_by(|a, b| a < b));
///
@@ -4108,7 +4105,7 @@ impl [T] {
/// assert!(empty.is_sorted_by(|a, b| false));
/// assert!(empty.is_sorted_by(|a, b| true));
/// ```
- #[unstable(feature = "is_sorted", reason = "new API", issue = "53485")]
+ #[stable(feature = "is_sorted", since = "CURRENT_RUSTC_VERSION")]
#[must_use]
pub fn is_sorted_by<'a, F>(&'a self, mut compare: F) -> bool
where
@@ -4128,13 +4125,11 @@ impl [T] {
/// # Examples
///
/// ```
- /// #![feature(is_sorted)]
- ///
/// assert!(["c", "bb", "aaa"].is_sorted_by_key(|s| s.len()));
/// assert!(![-2i32, -1, 0, 3].is_sorted_by_key(|n| n.abs()));
/// ```
#[inline]
- #[unstable(feature = "is_sorted", reason = "new API", issue = "53485")]
+ #[stable(feature = "is_sorted", since = "CURRENT_RUSTC_VERSION")]
#[must_use]
pub fn is_sorted_by_key<'a, F, K>(&'a self, f: F) -> bool
where
diff --git a/library/core/tests/lib.rs b/library/core/tests/lib.rs
index 4c225187882..51d57c9e37d 100644
--- a/library/core/tests/lib.rs
+++ b/library/core/tests/lib.rs
@@ -44,7 +44,6 @@
#![feature(hasher_prefixfree_extras)]
#![feature(hashmap_internals)]
#![feature(try_find)]
-#![feature(is_sorted)]
#![feature(layout_for_ptr)]
#![feature(pattern)]
#![feature(slice_take)]
diff --git a/src/doc/unstable-book/src/library-features/is-sorted.md b/src/doc/unstable-book/src/library-features/is-sorted.md
deleted file mode 100644
index e3b7dc3b28e..00000000000
--- a/src/doc/unstable-book/src/library-features/is-sorted.md
+++ /dev/null
@@ -1,11 +0,0 @@
-# `is_sorted`
-
-The tracking issue for this feature is: [#53485]
-
-[#53485]: https://github.com/rust-lang/rust/issues/53485
-
-------------------------
-
-Add the methods `is_sorted`, `is_sorted_by` and `is_sorted_by_key` to `[T]`;
-add the methods `is_sorted`, `is_sorted_by` and `is_sorted_by_key` to
-`Iterator`.
diff --git a/src/tools/clippy/clippy_lints/src/lib.rs b/src/tools/clippy/clippy_lints/src/lib.rs
index 917d9d36076..22d23a17509 100644
--- a/src/tools/clippy/clippy_lints/src/lib.rs
+++ b/src/tools/clippy/clippy_lints/src/lib.rs
@@ -5,7 +5,6 @@
#![feature(f128)]
#![feature(f16)]
#![feature(if_let_guard)]
-#![feature(is_sorted)]
#![feature(iter_intersperse)]
#![feature(iter_partition_in_place)]
#![feature(let_chains)]
diff --git a/src/tools/clippy/tests/compile-test.rs b/src/tools/clippy/tests/compile-test.rs
index ea3a0a93ecc..4e5120406b0 100644
--- a/src/tools/clippy/tests/compile-test.rs
+++ b/src/tools/clippy/tests/compile-test.rs
@@ -1,4 +1,3 @@
-#![feature(is_sorted)]
#![cfg_attr(feature = "deny-warnings", deny(warnings))]
#![warn(rust_2018_idioms, unused_lifetimes)]
#![allow(unused_extern_crates)]
diff --git a/src/tools/clippy/tests/ui/unit_return_expecting_ord.rs b/src/tools/clippy/tests/ui/unit_return_expecting_ord.rs
index 59b2f7e355b..5f62157dd6d 100644
--- a/src/tools/clippy/tests/ui/unit_return_expecting_ord.rs
+++ b/src/tools/clippy/tests/ui/unit_return_expecting_ord.rs
@@ -2,7 +2,6 @@
#![allow(clippy::needless_return)]
#![allow(clippy::unused_unit)]
#![allow(clippy::useless_vec)]
-#![feature(is_sorted)]
struct Struct {
field: isize,
diff --git a/src/tools/clippy/tests/ui/unit_return_expecting_ord.stderr b/src/tools/clippy/tests/ui/unit_return_expecting_ord.stderr
index b2fc8857015..329832048e8 100644
--- a/src/tools/clippy/tests/ui/unit_return_expecting_ord.stderr
+++ b/src/tools/clippy/tests/ui/unit_return_expecting_ord.stderr
@@ -1,11 +1,11 @@
error: this closure returns the unit type which also implements Ord
- --> tests/ui/unit_return_expecting_ord.rs:19:25
+ --> tests/ui/unit_return_expecting_ord.rs:18:25
|
LL | structs.sort_by_key(|s| {
| ^^^
|
help: probably caused by this trailing semicolon
- --> tests/ui/unit_return_expecting_ord.rs:21:24
+ --> tests/ui/unit_return_expecting_ord.rs:20:24
|
LL | double(s.field);
| ^
@@ -13,25 +13,25 @@ LL | double(s.field);
= help: to override `-D warnings` add `#[allow(clippy::unit_return_expecting_ord)]`
error: this closure returns the unit type which also implements PartialOrd
- --> tests/ui/unit_return_expecting_ord.rs:24:30
+ --> tests/ui/unit_return_expecting_ord.rs:23:30
|
LL | structs.is_sorted_by_key(|s| {
| ^^^
|
help: probably caused by this trailing semicolon
- --> tests/ui/unit_return_expecting_ord.rs:26:24
+ --> tests/ui/unit_return_expecting_ord.rs:25:24
|
LL | double(s.field);
| ^
error: this closure returns the unit type which also implements PartialOrd
- --> tests/ui/unit_return_expecting_ord.rs:28:30
+ --> tests/ui/unit_return_expecting_ord.rs:27:30
|
LL | structs.is_sorted_by_key(|s| {
| ^^^
error: this closure returns the unit type which also implements Ord
- --> tests/ui/unit_return_expecting_ord.rs:39:25
+ --> tests/ui/unit_return_expecting_ord.rs:38:25
|
LL | structs.sort_by_key(|s| unit(s.field));
| ^^^
diff --git a/tests/ui/array-slice-vec/slice_is_sorted_by_borrow.rs b/tests/ui/array-slice-vec/slice_is_sorted_by_borrow.rs
index 31f59f8f724..6ac90953a05 100644
--- a/tests/ui/array-slice-vec/slice_is_sorted_by_borrow.rs
+++ b/tests/ui/array-slice-vec/slice_is_sorted_by_borrow.rs
@@ -1,8 +1,6 @@
//@ check-pass
// regression test for https://github.com/rust-lang/rust/issues/53485#issuecomment-885393452
-#![feature(is_sorted)]
-
struct A {
name: String,
}
diff --git a/tests/ui/feature-gates/feature-gate-is_sorted.rs b/tests/ui/feature-gates/feature-gate-is_sorted.rs
deleted file mode 100644
index 359ed835bcb..00000000000
--- a/tests/ui/feature-gates/feature-gate-is_sorted.rs
+++ /dev/null
@@ -1,13 +0,0 @@
-fn main() {
- // Assert `Iterator` methods are unstable
- assert!([1, 2, 2, 9].iter().is_sorted());
- //~^ ERROR: use of unstable library feature 'is_sorted': new API
- assert!(![-2i32, -1, 0, 3].iter().is_sorted_by_key(|n| n.abs()));
- //~^ ERROR: use of unstable library feature 'is_sorted': new API
-
- // Assert `[T]` methods are unstable
- assert!([1, 2, 2, 9].is_sorted());
- //~^ ERROR: use of unstable library feature 'is_sorted': new API
- assert!(![-2i32, -1, 0, 3].is_sorted_by_key(|n| n.abs()));
- //~^ ERROR: use of unstable library feature 'is_sorted': new API
-}
diff --git a/tests/ui/feature-gates/feature-gate-is_sorted.stderr b/tests/ui/feature-gates/feature-gate-is_sorted.stderr
deleted file mode 100644
index f3e87659b02..00000000000
--- a/tests/ui/feature-gates/feature-gate-is_sorted.stderr
+++ /dev/null
@@ -1,43 +0,0 @@
-error[E0658]: use of unstable library feature 'is_sorted': new API
- --> $DIR/feature-gate-is_sorted.rs:3:33
- |
-LL | assert!([1, 2, 2, 9].iter().is_sorted());
- | ^^^^^^^^^
- |
- = note: see issue #53485 for more information
- = help: add `#![feature(is_sorted)]` to the crate attributes to enable
- = note: this compiler was built on YYYY-MM-DD; consider upgrading it if it is out of date
-
-error[E0658]: use of unstable library feature 'is_sorted': new API
- --> $DIR/feature-gate-is_sorted.rs:5:39
- |
-LL | assert!(![-2i32, -1, 0, 3].iter().is_sorted_by_key(|n| n.abs()));
- | ^^^^^^^^^^^^^^^^
- |
- = note: see issue #53485 for more information
- = help: add `#![feature(is_sorted)]` to the crate attributes to enable
- = note: this compiler was built on YYYY-MM-DD; consider upgrading it if it is out of date
-
-error[E0658]: use of unstable library feature 'is_sorted': new API
- --> $DIR/feature-gate-is_sorted.rs:9:26
- |
-LL | assert!([1, 2, 2, 9].is_sorted());
- | ^^^^^^^^^
- |
- = note: see issue #53485 for more information
- = help: add `#![feature(is_sorted)]` to the crate attributes to enable
- = note: this compiler was built on YYYY-MM-DD; consider upgrading it if it is out of date
-
-error[E0658]: use of unstable library feature 'is_sorted': new API
- --> $DIR/feature-gate-is_sorted.rs:11:32
- |
-LL | assert!(![-2i32, -1, 0, 3].is_sorted_by_key(|n| n.abs()));
- | ^^^^^^^^^^^^^^^^
- |
- = note: see issue #53485 for more information
- = help: add `#![feature(is_sorted)]` to the crate attributes to enable
- = note: this compiler was built on YYYY-MM-DD; consider upgrading it if it is out of date
-
-error: aborting due to 4 previous errors
-
-For more information about this error, try `rustc --explain E0658`.