Skip to content

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

Open
wants to merge 1 commit into
base: master
Choose a base branch
from

Conversation

KaranJain21
Copy link

Looks like some of the methods on VecDeque can be made const. I have tried making as many of them const as I could.

@rustbot
Copy link
Collaborator

rustbot commented Jul 28, 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

@rustbot rustbot added 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. labels Jul 28, 2025
@@ -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")]
Copy link
Contributor

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) {
Copy link
Contributor

@tgross35 tgross35 Jul 29, 2025

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

@tgross35
Copy link
Contributor

@rustbot author

@rustbot rustbot added S-waiting-on-author Status: This is awaiting some action (such as code changes or more information) from the author. and removed S-waiting-on-review Status: Awaiting review from the assignee but also interested parties. labels Jul 29, 2025
@rustbot
Copy link
Collaborator

rustbot commented Jul 29, 2025

Reminder, once the PR becomes ready for a review, use @rustbot ready.

@bors
Copy link
Collaborator

bors commented Jul 31, 2025

☔ The latest upstream changes (presumably #144718) made this pull request unmergeable. Please resolve the merge conflicts.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
S-waiting-on-author Status: This is awaiting some action (such as code changes or more information) from the author. T-libs Relevant to the library team, which will review and decide on the PR/issue.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants