Skip to content

Commit f6022a1

Browse files
committed
Auto merge of rust-lang#89144 - sexxi-goose:insig_stdlib, r=nikomatsakis
2229: Mark insignificant dtor in stdlib I looked at all public [stdlib Drop implementations](https://doc.rust-lang.org/stable/std/ops/trait.Drop.html#implementors) and categorized them into Insigificant/Maybe/Significant Drop. Reasons are noted here: https://docs.google.com/spreadsheets/d/19edb9r5lo2UqMrCOVjV0fwcSdS-R7qvKNL76q7tO8VA/edit#gid=1838773501 One thing missing from this PR is tagging HashMap as insigificant destructor as that needs some discussion. r? `@Mark-Simulacrum` cc `@nikomatsakis`
2 parents c35d9b1 + cde4747 commit f6022a1

File tree

8 files changed

+9
-0
lines changed

8 files changed

+9
-0
lines changed

alloc/src/collections/btree/map.rs

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -155,6 +155,7 @@ pub(super) const MIN_LEN: usize = node::MIN_LEN_AFTER_SPLIT;
155155
/// ```
156156
#[stable(feature = "rust1", since = "1.0.0")]
157157
#[cfg_attr(not(test), rustc_diagnostic_item = "BTreeMap")]
158+
#[rustc_insignificant_dtor]
158159
pub struct BTreeMap<K, V> {
159160
root: Option<Root<K, V>>,
160161
length: usize,
@@ -331,6 +332,7 @@ impl<K: fmt::Debug, V: fmt::Debug> fmt::Debug for IterMut<'_, K, V> {
331332
/// [`into_iter`]: IntoIterator::into_iter
332333
/// [`IntoIterator`]: core::iter::IntoIterator
333334
#[stable(feature = "rust1", since = "1.0.0")]
335+
#[rustc_insignificant_dtor]
334336
pub struct IntoIter<K, V> {
335337
range: LazyLeafRange<marker::Dying, K, V>,
336338
length: usize,

alloc/src/collections/linked_list.rs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -46,6 +46,7 @@ mod tests;
4646
/// [`VecDeque`]: super::vec_deque::VecDeque
4747
#[stable(feature = "rust1", since = "1.0.0")]
4848
#[cfg_attr(not(test), rustc_diagnostic_item = "LinkedList")]
49+
#[rustc_insignificant_dtor]
4950
pub struct LinkedList<T> {
5051
head: Option<NonNull<Node<T>>>,
5152
tail: Option<NonNull<Node<T>>>,

alloc/src/collections/vec_deque/mod.rs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -90,6 +90,7 @@ const MAXIMUM_ZST_CAPACITY: usize = 1 << (usize::BITS - 1); // Largest possible
9090
/// [`make_contiguous`]: VecDeque::make_contiguous
9191
#[cfg_attr(not(test), rustc_diagnostic_item = "vecdeque_type")]
9292
#[stable(feature = "rust1", since = "1.0.0")]
93+
#[rustc_insignificant_dtor]
9394
pub struct VecDeque<
9495
T,
9596
#[unstable(feature = "allocator_api", issue = "32838")] A: Allocator = Global,

alloc/src/rc.rs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -305,6 +305,7 @@ struct RcBox<T: ?Sized> {
305305
/// [get_mut]: Rc::get_mut
306306
#[cfg_attr(not(test), rustc_diagnostic_item = "Rc")]
307307
#[stable(feature = "rust1", since = "1.0.0")]
308+
#[rustc_insignificant_dtor]
308309
pub struct Rc<T: ?Sized> {
309310
ptr: NonNull<RcBox<T>>,
310311
phantom: PhantomData<RcBox<T>>,

alloc/src/vec/into_iter.rs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -22,6 +22,7 @@ use core::slice::{self};
2222
/// let iter: std::vec::IntoIter<_> = v.into_iter();
2323
/// ```
2424
#[stable(feature = "rust1", since = "1.0.0")]
25+
#[rustc_insignificant_dtor]
2526
pub struct IntoIter<
2627
T,
2728
#[unstable(feature = "allocator_api", issue = "32838")] A: Allocator = Global,

alloc/src/vec/mod.rs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -396,6 +396,7 @@ mod spec_extend;
396396
/// [owned slice]: Box
397397
#[stable(feature = "rust1", since = "1.0.0")]
398398
#[cfg_attr(not(test), rustc_diagnostic_item = "vec_type")]
399+
#[rustc_insignificant_dtor]
399400
pub struct Vec<T, #[unstable(feature = "allocator_api", issue = "32838")] A: Allocator = Global> {
400401
buf: RawVec<T, A>,
401402
len: usize,

core/src/array/iter.rs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,7 @@ use crate::{
1010

1111
/// A by-value [array] iterator.
1212
#[stable(feature = "array_value_iter", since = "1.51.0")]
13+
#[rustc_insignificant_dtor]
1314
pub struct IntoIter<T, const N: usize> {
1415
/// This is the array we are iterating over.
1516
///

std/src/collections/hash/map.rs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -205,6 +205,7 @@ use crate::sys;
205205
206206
#[cfg_attr(not(test), rustc_diagnostic_item = "hashmap_type")]
207207
#[stable(feature = "rust1", since = "1.0.0")]
208+
#[rustc_insignificant_dtor]
208209
pub struct HashMap<K, V, S = RandomState> {
209210
base: base::HashMap<K, V, S>,
210211
}

0 commit comments

Comments
 (0)