Skip to content

Commit

Permalink
Unrolled build for rust-lang#136071
Browse files Browse the repository at this point in the history
Rollup merge of rust-lang#136071 - wowinter13:clippy-add-diagnostic-items, r=flip1995

[Clippy] Add vec_reserve & vecdeque_reserve diagnostic items

I’m currently working on reviving this lint (rust-lang/rust-clippy#10157), and there was [a comment](rust-lang/rust-clippy#10157 (comment)) from ``@flip1995`` regarding the necessity of adding new diagnostic items.
  • Loading branch information
rust-timer authored Jan 28, 2025
2 parents 77a4553 + 2117afd commit 1458964
Show file tree
Hide file tree
Showing 3 changed files with 4 additions and 0 deletions.
2 changes: 2 additions & 0 deletions compiler/rustc_span/src/symbol.rs
Original file line number Diff line number Diff line change
Expand Up @@ -2184,8 +2184,10 @@ symbols! {
vec_macro,
vec_new,
vec_pop,
vec_reserve,
vec_with_capacity,
vecdeque_iter,
vecdeque_reserve,
vector,
version,
vfp2,
Expand Down
1 change: 1 addition & 0 deletions library/alloc/src/collections/vec_deque/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -823,6 +823,7 @@ impl<T, A: Allocator> VecDeque<T, A> {
/// assert!(buf.capacity() >= 11);
/// ```
#[stable(feature = "rust1", since = "1.0.0")]
#[cfg_attr(not(test), rustc_diagnostic_item = "vecdeque_reserve")]
#[track_caller]
pub fn reserve(&mut self, additional: usize) {
let new_cap = self.len.checked_add(additional).expect("capacity overflow");
Expand Down
1 change: 1 addition & 0 deletions library/alloc/src/vec/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -1267,6 +1267,7 @@ impl<T, A: Allocator> Vec<T, A> {
#[cfg(not(no_global_oom_handling))]
#[stable(feature = "rust1", since = "1.0.0")]
#[track_caller]
#[cfg_attr(not(test), rustc_diagnostic_item = "vec_reserve")]
pub fn reserve(&mut self, additional: usize) {
self.buf.reserve(self.len, additional);
}
Expand Down

0 comments on commit 1458964

Please sign in to comment.