Rollup merge of #163459 - petrak-at-canonical:vec-try-remove, r=hanna-kruppe

Stabilize vec_try_remove

Closes rust-lang/rust#146954 , which is has [completed its FCP with disposition to merge](https://github.com/rust-lang/rust/issues/146954#issuecomment-5072327920).

Hello, this is my first contribution to Rust! I was programming for fun this weekend and I was surprised that this wasn't stabilized, so I thought I would try to contribute.

Disclosure: I am making this PR in my capacity as a Canonical employee.

No LLMs were harmed in the making of this pull request.
This commit is contained in:
Trevor Gross
2026-09-28 23:20:45 -05:00
committed by GitHub
2 changed files with 1 additions and 3 deletions

View File

@@ -2421,12 +2421,11 @@ impl<T, A: Allocator> Vec<T, A> {
/// # Examples
///
/// ```
/// #![feature(vec_try_remove)]
/// let mut v = vec![1, 2, 3];
/// assert_eq!(v.try_remove(0), Some(1));
/// assert_eq!(v.try_remove(2), None);
/// ```
#[unstable(feature = "vec_try_remove", issue = "146954")]
#[stable(feature = "vec_try_remove", since = "CURRENT_RUSTC_VERSION")]
#[rustc_confusables("delete", "take", "remove")]
pub fn try_remove(&mut self, index: usize) -> Option<T> {
let len = self.len();

View File

@@ -60,7 +60,6 @@
#![feature(unique_rc_arc)]
#![feature(vec_deque_retain_range)]
#![feature(vec_peek_mut)]
#![feature(vec_try_remove)]
#![feature(write_all_vectored)]
// tidy-alphabetical-end