Skip to content

Add experimental fallible::Vec#157394

Open
ChrisDenton wants to merge 1 commit into
rust-lang:mainfrom
ChrisDenton:fallible-vec
Open

Add experimental fallible::Vec#157394
ChrisDenton wants to merge 1 commit into
rust-lang:mainfrom
ChrisDenton:fallible-vec

Conversation

@ChrisDenton
Copy link
Copy Markdown
Member

@ChrisDenton ChrisDenton commented Jun 3, 2026

Tracking issue: #157392

There are a few things to be aware of here:

  1. This is still experimental. It might be removed at any time so we have to be careful about any interdependency between this and Vec
  2. Vec is a pretty crucial part of rust's standard library. We have to be extremely careful touching its code. We might regress performance or make debugging worse.

With that in mind, this PR does the minimum necessary for an MVP fallible::Vec. The only actually new thing it adds is fallible push and push_mut methods. The rest just forwards to Vec equivalents. Further APIs can be added (carefully) afterwards.

I apologise for the number of lines changed in the PR but they are mostly copy/pasted docs (I wanted them for the testable examples mostly). We should probably find a better way of duplicating them but I think this works for a minimally intrusive experiment.

@rustbot rustbot added S-waiting-on-review Status: Awaiting review from the assignee but also interested parties. T-libs Relevant to the library team, which will review and decide on the PR/issue. labels Jun 3, 2026
@rustbot
Copy link
Copy Markdown
Collaborator

rustbot commented Jun 3, 2026

r? @Mark-Simulacrum

rustbot has assigned @Mark-Simulacrum.
They will have a look at your PR within the next two weeks and either review your PR or reassign to another reviewer.

Use r? to explicitly pick a reviewer

Why was this reviewer chosen?

The reviewer was selected based on:

  • Owners of files modified in this PR: libs
  • libs expanded to 8 candidates
  • Random selection from Mark-Simulacrum, jhpratt

@rust-log-analyzer

This comment has been minimized.

@ChrisDenton
Copy link
Copy Markdown
Member Author

 -	   = note: multiple `impl`s satisfying `Vec<_>: aux::Trait` found in the `unstable_impl_method_selection_aux` crate:
 -	           - impl aux::Trait for Vec<u32>;
 -	           - impl aux::Trait for Vec<u64>
 +	   = note: multiple `impl`s satisfying `std::vec::Vec<_>: aux::Trait` found in the `unstable_impl_method_selection_aux` crate:
 +	           - impl aux::Trait for std::vec::Vec<u32>;
 +	           - impl aux::Trait for std::vec::Vec<u64>

Ooph, that's unfortunate. Simplest thing is to rename this type. But I do wonder if that could be fixed.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

S-waiting-on-review Status: Awaiting review from the assignee but also interested parties. T-libs Relevant to the library team, which will review and decide on the PR/issue.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants