mirror of
https://github.com/rust-lang/rust.git
synced 2024-11-01 06:51:58 +00:00
comments explaining why we have and don't have ManuallyDrop
This commit is contained in:
parent
901cd3a844
commit
3a1e114120
@ -175,6 +175,7 @@ pub struct BTreeMap<
|
||||
> {
|
||||
root: Option<Root<K, V>>,
|
||||
length: usize,
|
||||
/// `ManuallyDrop` to control drop order (needs to be dropped after all the nodes).
|
||||
pub(super) alloc: ManuallyDrop<A>,
|
||||
}
|
||||
|
||||
@ -384,6 +385,7 @@ pub struct IntoIter<
|
||||
> {
|
||||
range: LazyLeafRange<marker::Dying, K, V>,
|
||||
length: usize,
|
||||
/// The BTreeMap will outlive this IntoIter so we don't care about drop order for `alloc`.
|
||||
alloc: A,
|
||||
}
|
||||
|
||||
@ -1800,6 +1802,7 @@ pub struct DrainFilter<
|
||||
{
|
||||
pred: F,
|
||||
inner: DrainFilterInner<'a, K, V>,
|
||||
/// The BTreeMap will outlive this IntoIter so we don't care about drop order for `alloc`.
|
||||
alloc: A,
|
||||
}
|
||||
/// Most of the implementation of DrainFilter are generic over the type
|
||||
|
@ -56,6 +56,7 @@ pub struct VacantEntry<
|
||||
pub(super) handle: Option<Handle<NodeRef<marker::Mut<'a>, K, V, marker::Leaf>, marker::Edge>>,
|
||||
pub(super) dormant_map: DormantMutRef<'a, BTreeMap<K, V, A>>,
|
||||
|
||||
/// The BTreeMap will outlive this IntoIter so we don't care about drop order for `alloc`.
|
||||
pub(super) alloc: A,
|
||||
|
||||
// Be invariant in `K` and `V`
|
||||
@ -81,6 +82,7 @@ pub struct OccupiedEntry<
|
||||
pub(super) handle: Handle<NodeRef<marker::Mut<'a>, K, V, marker::LeafOrInternal>, marker::KV>,
|
||||
pub(super) dormant_map: DormantMutRef<'a, BTreeMap<K, V, A>>,
|
||||
|
||||
/// The BTreeMap will outlive this IntoIter so we don't care about drop order for `alloc`.
|
||||
pub(super) alloc: A,
|
||||
|
||||
// Be invariant in `K` and `V`
|
||||
|
@ -1285,6 +1285,7 @@ pub struct DrainFilter<
|
||||
{
|
||||
pred: F,
|
||||
inner: super::map::DrainFilterInner<'a, T, ()>,
|
||||
/// The BTreeMap will outlive this IntoIter so we don't care about drop order for `alloc`.
|
||||
alloc: A,
|
||||
}
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user