-
Notifications
You must be signed in to change notification settings - Fork 13.6k
make some vecdeque methods const #144612
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?
make some vecdeque methods const #144612
Conversation
@@ -713,7 +714,8 @@ impl<T, A: Allocator> VecDeque<T, A> { | |||
/// assert_eq!(buf[1], 7); | |||
/// ``` | |||
#[stable(feature = "rust1", since = "1.0.0")] | |||
pub fn get_mut(&mut self, index: usize) -> Option<&mut T> { | |||
#[rustc_const_stable(feature = "const_vecdeque_methods", since = "1.90.0")] |
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.
This would make these immediately stable, which we don't want to do. Please change this to rustc_const_unstable
and create a new tracking issue.
@@ -168,7 +168,7 @@ impl<T, A: Allocator> VecDeque<T, A> { | |||
/// | |||
/// May only be called if `deque.len() < deque.capacity()` | |||
#[inline] | |||
unsafe fn push_unchecked(&mut self, element: T) { | |||
const unsafe fn push_unchecked(&mut self, element: T) { |
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.
This function is internal-only and doesn't seem to need to be const
to support public API. Please drop changes to anything that isn't strictly necessary to support making the public functions in this PR const
, to make it clear exactly what we're (unstably) committing to here.
The same thing applies to a handful of function here
@rustbot author |
Reminder, once the PR becomes ready for a review, use |
☔ The latest upstream changes (presumably #144718) made this pull request unmergeable. Please resolve the merge conflicts. |
Looks like some of the methods on
VecDeque
can be made const. I have tried making as many of them const as I could.