diff options
| author | bors <bors@rust-lang.org> | 2020-06-20 19:14:52 +0000 |
|---|---|---|
| committer | bors <bors@rust-lang.org> | 2020-06-20 19:14:52 +0000 |
| commit | f455e46eae1a227d735091091144601b467e1565 (patch) | |
| tree | c7252184d324a8497b66fd34a03cc2f4ffd84edc /src/liballoc | |
| parent | 033013cab3a861224fd55f494c8be1cb0349eb49 (diff) | |
| parent | bb0016bdec30cb88370428ec124c33d6f341aad3 (diff) | |
| download | rust-f455e46eae1a227d735091091144601b467e1565.tar.gz rust-f455e46eae1a227d735091091144601b467e1565.zip | |
Auto merge of #73550 - RalfJung:rollup-5huj1k1, r=RalfJung
Rollup of 9 pull requests Successful merges: - #72600 (Properly encode AnonConst into crate metadata) - #73055 (remove leftover mentions of `skol` and `int` from the compiler) - #73058 (Support sanitizers on aarch64-unknown-linux-gnu) - #73171 (RISC-V Emulated Testing) - #73404 (Update CFGuard syntax) - #73444 (ci: disable alt build during try builds) - #73471 (Prevent attacker from manipulating FPU tag word used in SGX enclave) - #73539 (Deprecate `Vec::remove_item`) - #73543 (Clean up E0695 explanation) Failed merges: r? @ghost
Diffstat (limited to 'src/liballoc')
| -rw-r--r-- | src/liballoc/tests/lib.rs | 1 | ||||
| -rw-r--r-- | src/liballoc/tests/vec.rs | 15 | ||||
| -rw-r--r-- | src/liballoc/vec.rs | 18 |
3 files changed, 8 insertions, 26 deletions
diff --git a/src/liballoc/tests/lib.rs b/src/liballoc/tests/lib.rs index f3da46bd0cc..e2dc816b015 100644 --- a/src/liballoc/tests/lib.rs +++ b/src/liballoc/tests/lib.rs @@ -12,7 +12,6 @@ #![feature(associated_type_bounds)] #![feature(binary_heap_into_iter_sorted)] #![feature(binary_heap_drain_sorted)] -#![feature(vec_remove_item)] #![feature(split_inclusive)] #![feature(binary_heap_retain)] diff --git a/src/liballoc/tests/vec.rs b/src/liballoc/tests/vec.rs index a9813a8704f..baa02b8997f 100644 --- a/src/liballoc/tests/vec.rs +++ b/src/liballoc/tests/vec.rs @@ -132,21 +132,6 @@ fn test_extend_ref() { } #[test] -fn test_remove_item() { - let mut v = vec![1, 2, 3]; - v.remove_item(&1); - - assert_eq!(v.len(), 2); - assert_eq!(v, [2, 3]); - - let mut w = vec![1, 2, 3]; - w.remove_item(&4); - - assert_eq!(w.len(), 3); - w.remove_item(&4); -} - -#[test] fn test_slice_from_mut() { let mut values = vec![1, 2, 3, 4, 5]; { diff --git a/src/liballoc/vec.rs b/src/liballoc/vec.rs index 95c3b3b1861..0531084d0e4 100644 --- a/src/liballoc/vec.rs +++ b/src/liballoc/vec.rs @@ -1760,17 +1760,15 @@ impl<T: PartialEq> Vec<T> { impl<T> Vec<T> { /// Removes the first instance of `item` from the vector if the item exists. /// - /// # Examples - /// - /// ``` - /// # #![feature(vec_remove_item)] - /// let mut vec = vec![1, 2, 3, 1]; - /// - /// vec.remove_item(&1); - /// - /// assert_eq!(vec, vec![2, 3, 1]); - /// ``` + /// This method will be removed soon. #[unstable(feature = "vec_remove_item", reason = "recently added", issue = "40062")] + #[rustc_deprecated( + reason = "Removing the first item equal to a needle is already easily possible \ + with iterators and the current Vec methods. Furthermore, having a method for \ + one particular case of removal (linear search, only the first item, no swap remove) \ + but not for others is inconsistent. This method will be removed soon.", + since = "1.46.0" + )] pub fn remove_item<V>(&mut self, item: &V) -> Option<T> where T: PartialEq<V>, |
