-
Notifications
You must be signed in to change notification settings - Fork 13.8k
Make PeekMut
generic over the allocator
#146621
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: master
Are you sure you want to change the base?
Conversation
r? libs-api |
Vec::peek_mut
PeekMut
generic over the allocator
c2c526d
to
7dd447e
Compare
This comment has been minimized.
This comment has been minimized.
7dd447e
to
cc0a3d4
Compare
There was a problem hiding this 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.
@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 |
library/alloc/src/vec/peek_mut.rs
Outdated
#[unstable(feature = "vec_peek_mut", issue = "122742")] | ||
pub struct PeekMut<'a, T> { | ||
vec: &'a mut Vec<T>, | ||
pub struct PeekMut<'a, T, A: Allocator> { |
There was a problem hiding this comment.
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
,
There was a problem hiding this comment.
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?
r=me once the generic parameter is fixed. |
cc0a3d4
to
934ee04
Compare
Related: #122742