-
Notifications
You must be signed in to change notification settings - Fork 12.8k
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
Implementation for rust-lang/libs-team#138 #105072
Conversation
Hey! It looks like you've submitted a new PR for the library teams! If this PR contains changes to any Examples of
|
@rustbot label +T-libs-api -T-libs |
Co-authored-by: scottmcm <scottmcm@users.noreply.github.com>
pub fn new() -> VecDeque<T> { | ||
VecDeque::new_in(Global) | ||
pub const fn new() -> VecDeque<T> { | ||
// FIXME: This should just be `VecDeque::new_in(Global)` once that's stable. |
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.
You could also slap #[allow_internal_unstable(allocator_api)]
onto VecDeque::new
instead. Not sure if that's frowned upon though. What does the library team say?
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.
Thank you @Sp00ph. The contents of the PR look good, but could I please get you to split this into 3 independent PRs?
-
The
VecDeque::new
const stabilization. This requires team approval but it will just sail through, there is no reason this would be controversial. -
Adding const to the unstable
VecDeque::new_in
. This does not need team approval because it's a change to an unstable API. I can unilaterally approve this. We can stick your comment fix insidemake_contiguous
in here too. -
The
From
conversion performance guarantee. A new stable guarantee requires team approval and this one needs more careful consideration than your const changes. It will be more convenient for the team if these can be considered independently.
@dtolnay I opened a PR for each of those changes as you can see. Should I |
Great! |
Make `VecDeque::new_in` unstably const (See rust-lang#105072)
Make `VecDeque::new` const (See rust-lang#105072)
Make `VecDeque::new` const (See rust-lang#105072)
…=dtolnay Add O(1) `Vec -> VecDeque` conversion guarantee (See rust-lang#105072)
(See rust-lang/libs-team#138)
@scottmcm mentioned in the linked ACP that he'd be tempted to go straight to stable with these changes, as they don't include any complicated new compile-time functionality, so here I am, shooting my shot. If I instead should go through the process of first making it unstably const and then make it stable in a later PR, then I can also change this PR to do that.
r? @dtolnay