Add is_sorted unstable documentation

This commit is contained in:
Kevin Leimkuhler 2018-10-12 14:47:01 -07:00
parent 02477f6f99
commit ce47dde59f
5 changed files with 41 additions and 3 deletions

View file

@ -9,8 +9,15 @@
// except according to those terms.
fn main() {
// Assert `Iterator` methods are feature gated
assert!([1, 2, 2, 9].iter().is_sorted());
//^ ERROR: use of unstable library feature 'is_sorted'
assert!(![-2i32, -1, 0, 3].iter().is_sorted_by_key(|n| n.abs()));
//^ ERROR: use of unstable library feature 'is_sorted'
// Assert `[T]` methods are feature gated
assert!([1, 2, 2, 9].is_sorted());
//^ ERROR: use of unstable library feature 'is_sorted'
assert!(![-2i32, -1, 0, 3].is_sorted_by_key(|n| n.abs()));
//^ ERROR: use of unstable library feature 'is_sorted'
}

View file

@ -1,5 +1,5 @@
error[E0658]: use of unstable library feature 'is_sorted': new API (see issue #53485)
--> $DIR/feature-gate-is_sorted.rs:12:33
--> $DIR/feature-gate-is_sorted.rs:13:33
|
LL | assert!([1, 2, 2, 9].iter().is_sorted());
| ^^^^^^^^^
@ -7,13 +7,29 @@ LL | assert!([1, 2, 2, 9].iter().is_sorted());
= help: add #![feature(is_sorted)] to the crate attributes to enable
error[E0658]: use of unstable library feature 'is_sorted': new API (see issue #53485)
--> $DIR/feature-gate-is_sorted.rs:14:39
--> $DIR/feature-gate-is_sorted.rs:15:39
|
LL | assert!(![-2i32, -1, 0, 3].iter().is_sorted_by_key(|n| n.abs()));
| ^^^^^^^^^^^^^^^^
|
= help: add #![feature(is_sorted)] to the crate attributes to enable
error: aborting due to 2 previous errors
error[E0658]: use of unstable library feature 'is_sorted': new API (see issue #53485)
--> $DIR/feature-gate-is_sorted.rs:19:26
|
LL | assert!([1, 2, 2, 9].is_sorted());
| ^^^^^^^^^
|
= help: add #![feature(is_sorted)] to the crate attributes to enable
error[E0658]: use of unstable library feature 'is_sorted': new API (see issue #53485)
--> $DIR/feature-gate-is_sorted.rs:21:32
|
LL | assert!(![-2i32, -1, 0, 3].is_sorted_by_key(|n| n.abs()));
| ^^^^^^^^^^^^^^^^
|
= help: add #![feature(is_sorted)] to the crate attributes to enable
error: aborting due to 4 previous errors
For more information about this error, try `rustc --explain E0658`.