Skip to content

Conversation

cammeresi
Copy link
Contributor

@cammeresi cammeresi commented Sep 16, 2025

  • plumb in allocator generic
  • additional testing

Related: #122742

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

rustbot commented Sep 16, 2025

r? @tgross35

rustbot has assigned @tgross35.
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

@joboet
Copy link
Member

joboet commented Sep 18, 2025

r? libs-api

@rustbot rustbot added the T-libs-api Relevant to the library API team, which will review and decide on the PR/issue. label Sep 18, 2025
@rustbot rustbot assigned BurntSushi and unassigned tgross35 Sep 18, 2025
@joboet joboet changed the title Minor improvements to Vec::peek_mut Make PeekMut generic over the allocator Sep 18, 2025
@rust-log-analyzer

This comment has been minimized.

Copy link
Member

@joboet joboet left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks great! This needs approval from someone in T-libs-api though, so it can't be merged just yet.

View changes since this review

@tgross35
Copy link
Contributor

tgross35 commented Sep 18, 2025

@rust-lang/libs-api anybody willing to give a quick thumbs up here? Straightforward extension to unstable API.

@cammeresi please squash when you get the chance

#[unstable(feature = "vec_peek_mut", issue = "122742")]
pub struct PeekMut<'a, T> {
vec: &'a mut Vec<T>,
pub struct PeekMut<'a, T, A: Allocator> {
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The allocator parameter should be unstable and default to Global, just like that of Vec,

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks, I was going to ask. I wasn't sure since there's no public entry point by which to create one directly. I guess the point is to be defensive against such an accidental change?

Does that mean that std::collections::btree_map::IntoKeys is incorrectly missing the attribute?

@Amanieu
Copy link
Member

Amanieu commented Sep 19, 2025

r=me once the generic parameter is 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. T-libs-api Relevant to the library API team, which will review and decide on the PR/issue.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

7 participants