-
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
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?
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.
It's sort of indirectly gated because there is nothing stable implementing Allocator
that you could specify in that position. But yeah, I think IntoKeys
should technically have the same unstable attribute. Feel free to put up a PR if you're interested.
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.
r=me once the generic parameter is fixed. |
cc0a3d4
to
934ee04
Compare
@tgross35 Am I supposed to ping now that I've updated? (Also, if you can answer my review question, I'd appreciate it.) |
@bors r+ |
☀️ Test successful - checks-actions |
What is this?This is an experimental post-merge analysis report that shows differences in test outcomes between the merged PR and its parent PR.Comparing ec38671 (parent) -> e4b5219 (this PR) Test differencesShow 200 test diffs200 doctest diffs were found. These are ignored, as they are noisy. Test dashboardRun cargo run --manifest-path src/ci/citool/Cargo.toml -- \
test-dashboard e4b521903b3b1a671e26a70b9475bcff385767e5 --output-dir test-dashboard And then open Job duration changes
How to interpret the job duration changes?Job durations can vary a lot, based on the actual runner instance |
Finished benchmarking commit (e4b5219): comparison URL. Overall result: no relevant changes - no action needed@rustbot label: -perf-regression Instruction countThis benchmark run did not return any relevant results for this metric. Max RSS (memory usage)This benchmark run did not return any relevant results for this metric. CyclesThis benchmark run did not return any relevant results for this metric. Binary sizeThis benchmark run did not return any relevant results for this metric. Bootstrap: 470.599s -> 472.018s (0.30%) |
Make `PeekMut` generic over the allocator - plumb in allocator generic - additional testing Related: rust-lang#122742
Related: #122742