Skip to content
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.

Commit 1406186

Browse files
committedApr 10, 2020
Auto merge of #70994 - Centril:rollup-lftv0a3, r=Centril
Rollup of 9 pull requests Successful merges: - #69745 (Use `PredicateObligation`s instead of `Predicate`s) - #70938 (Add ThreadSanitizer test case) - #70973 (Use forward traversal for unconditional recursion lint) - #70978 (compiletest: let config flags overwrite -A unused) - #70979 (Follow up on BTreeMap comments) - #70981 (Rearrange BTreeMap::into_iter to match range_mut.) - #70985 (Clean up E0512 explanation) - #70988 (Setup the `@rustbot prioritize` command) - #70991 (fix rustc-dev-guide's url in src/librustc_codegen_ssa) Failed merges: r? @ghost
2 parents 9682f0e + 178aa6a commit 1406186

File tree

217 files changed

+754
-565
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

217 files changed

+754
-565
lines changed
 

‎src/liballoc/collections/btree/map.rs

Lines changed: 13 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -1544,19 +1544,19 @@ impl<K, V> IntoIterator for BTreeMap<K, V> {
15441544
type IntoIter = IntoIter<K, V>;
15451545

15461546
fn into_iter(self) -> IntoIter<K, V> {
1547-
let me = ManuallyDrop::new(self);
1548-
if me.root.is_none() {
1549-
return IntoIter { front: None, back: None, length: 0 };
1550-
}
1551-
1552-
let root1 = unsafe { unwrap_unchecked(ptr::read(&me.root)).into_ref() };
1553-
let root2 = unsafe { unwrap_unchecked(ptr::read(&me.root)).into_ref() };
1554-
let len = me.length;
1555-
1556-
IntoIter {
1557-
front: Some(root1.first_leaf_edge()),
1558-
back: Some(root2.last_leaf_edge()),
1559-
length: len,
1547+
let mut me = ManuallyDrop::new(self);
1548+
if let Some(root) = me.root.as_mut() {
1549+
let root1 = unsafe { ptr::read(root).into_ref() };
1550+
let root2 = unsafe { ptr::read(root).into_ref() };
1551+
let len = me.length;
1552+
1553+
IntoIter {
1554+
front: Some(root1.first_leaf_edge()),
1555+
back: Some(root2.last_leaf_edge()),
1556+
length: len,
1557+
}
1558+
} else {
1559+
IntoIter { front: None, back: None, length: 0 }
15601560
}
15611561
}
15621562
}
@@ -2771,8 +2771,6 @@ impl<'a, K: 'a, V: 'a> Handle<NodeRef<marker::Mut<'a>, K, V, marker::LeafOrInter
27712771
pos.next_unchecked();
27722772
}
27732773
}
2774-
2775-
// This internal node might be underfull, but only if it's the root.
27762774
break;
27772775
}
27782776
}

‎src/liballoc/collections/btree/node.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -161,7 +161,7 @@ impl<K, V> Root<K, V> {
161161
NodeRef {
162162
height: self.height,
163163
node: self.node.as_ptr(),
164-
root: self as *const _ as *mut _,
164+
root: ptr::null(),
165165
_marker: PhantomData,
166166
}
167167
}
@@ -179,7 +179,7 @@ impl<K, V> Root<K, V> {
179179
NodeRef {
180180
height: self.height,
181181
node: self.node.as_ptr(),
182-
root: ptr::null_mut(), // FIXME: Is there anything better to do here?
182+
root: ptr::null(),
183183
_marker: PhantomData,
184184
}
185185
}

0 commit comments

Comments
 (0)
Please sign in to comment.