Skip to content
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

Rollup of 10 pull requests #75684

Closed
wants to merge 46 commits into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
46 commits
Select commit Hold shift + click to select a range
e720f42
See also X-Link mem::{swap, take, replace}
Havvy Aug 2, 2020
7835c8c
docs(marker/copy): clarify that `&T` is also `Copy`
janriemer Aug 2, 2020
9b0f3d1
Fix documentation error
jack-champagne Aug 13, 2020
a876b3d
docs(marker/copy): provide example for `&T` being `Copy`
janriemer Aug 16, 2020
43dec0e
rephrase: struct -> type
janriemer Aug 16, 2020
dce8644
add back emojis that have been removed accidentally
janriemer Aug 16, 2020
9061da2
add empty line above code block
janriemer Aug 16, 2020
56daf63
docs: add `derive` for struct
janriemer Aug 16, 2020
b0eb55a
Add test demonstrating the issue.
jumbatm Aug 15, 2020
db75313
Fix stack overflow for recursive types.
jumbatm Aug 15, 2020
154b74e
Actually introduce a cycle in Reffy test.
jumbatm Aug 16, 2020
a1fa4e0
Remove unnecessary rebinding of def ids.
jumbatm Aug 16, 2020
80c2c80
Remove structural equiv check for Array const.
jumbatm Aug 16, 2020
bca48ad
Reduce indentation by replacing match arm w/ early return.
jumbatm Aug 16, 2020
6c57de1
Don't memoize seen types.
jumbatm Aug 16, 2020
7708abb
Avoid double hashset lookup.
jumbatm Aug 16, 2020
1321a2d
Also accept Refs for is_primitive_or_pointer
jumbatm Aug 16, 2020
bc15dd6
Wrap recursion in `ensure_sufficient_stack`.
jumbatm Aug 17, 2020
431a465
Move to intra doc links for keyword documentation
poliorcetics Aug 17, 2020
a4995fc
Refactor `impl_for_type` into a separate function
jyn514 Aug 17, 2020
833bbb1
Say `tcx.lang_items()` less
jyn514 Aug 17, 2020
dae3a4f
Return all impls, not just the primary one
jyn514 Aug 17, 2020
c6ac860
impl_for_type -> PrimitiveType::impls
jyn514 Aug 17, 2020
3b1d2e3
Allow reusing the code in `collect_trait_impls`
jyn514 Aug 17, 2020
1b74f04
Use `impls` for intra doc links as well
jyn514 Aug 17, 2020
2858074
xpy fmt
jyn514 Aug 17, 2020
7be824e
Add a test
jyn514 Aug 17, 2020
38b920d
Capture output from threads spawned in tests
tmandry Aug 5, 2020
e24aa73
rewrite old test so that its attributes are consistent with what we w…
pnkfelix Jun 15, 2020
01e8e9f
When building lint specs map for a given scope, check if forbid prese…
pnkfelix Jun 15, 2020
ef03a5d
Regression test.
pnkfelix Jun 15, 2020
4ec4c4f
review suggestion: use existing defn rather than new intern call
pnkfelix Jun 30, 2020
8c4641b
BTreeMap: check some invariants, avoid recursion in depth first search
ssomers Aug 18, 2020
d9d84dc
Add doc examples count for --show-coverage
GuillaumeGomez Aug 18, 2020
f957bae
Update rustdoc-ui tests
GuillaumeGomez Aug 18, 2020
522d177
docs: add another `derive` for `Copy`able struct
Aug 18, 2020
7ae6928
Rollup merge of #73379 - pnkfelix:issue-70819-disallow-override-forbi…
tmandry Aug 18, 2020
3271a75
Rollup merge of #75038 - rust-lang:Havvy-patch-1, r=steveklabnik
tmandry Aug 18, 2020
36ac8ec
Rollup merge of #75049 - janriemer:patch-1, r=poliorcetics
tmandry Aug 18, 2020
03922c6
Rollup merge of #75172 - tmandry:test-thread-capture, r=dtolnay
tmandry Aug 18, 2020
c0f429f
Rollup merge of #75480 - ssomers:btree_check_invariant, r=Mark-Simula…
tmandry Aug 18, 2020
61e2369
Rollup merge of #75499 - jack-champagne:jack-champagne/issue-75412, r…
tmandry Aug 18, 2020
e6b2bd6
Rollup merge of #75554 - jumbatm:fix-clashing-extern-decl-overflow, r…
tmandry Aug 18, 2020
c915685
Rollup merge of #75646 - poliorcetics:intra-links-keywords, r=jyn514
tmandry Aug 18, 2020
198dce3
Rollup merge of #75649 - jyn514:inherent-lang-impls, r=GuillaumeGomez
tmandry Aug 18, 2020
5dc062e
Rollup merge of #75665 - GuillaumeGomez:doc-examples-coverage, r=jyn514
tmandry Aug 18, 2020
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions Cargo.lock
Original file line number Diff line number Diff line change
Expand Up @@ -4052,6 +4052,7 @@ dependencies = [
"rustc-rayon",
"serde",
"serde_json",
"smallvec 1.4.0",
"tempfile",
]

Expand Down
35 changes: 3 additions & 32 deletions library/alloc/src/collections/btree/map.rs
Original file line number Diff line number Diff line change
Expand Up @@ -1236,10 +1236,10 @@ impl<K: Ord, V> BTreeMap<K, V> {
right_root.fix_left_border();

if left_root.height() < right_root.height() {
self.recalc_length();
self.length = left_root.node_as_ref().calc_length();
right.length = total_num - self.len();
} else {
right.recalc_length();
right.length = right_root.node_as_ref().calc_length();
self.length = total_num - right.len();
}

Expand Down Expand Up @@ -1283,42 +1283,13 @@ impl<K: Ord, V> BTreeMap<K, V> {
{
DrainFilter { pred, inner: self.drain_filter_inner() }
}

pub(super) fn drain_filter_inner(&mut self) -> DrainFilterInner<'_, K, V> {
let root_node = self.root.as_mut().map(|r| r.node_as_mut());
let front = root_node.map(|rn| rn.first_leaf_edge());
DrainFilterInner { length: &mut self.length, cur_leaf_edge: front }
}

/// Calculates the number of elements if it is incorrect.
fn recalc_length(&mut self) {
fn dfs<'a, K, V>(node: NodeRef<marker::Immut<'a>, K, V, marker::LeafOrInternal>) -> usize
where
K: 'a,
V: 'a,
{
let mut res = node.len();

if let Internal(node) = node.force() {
let mut edge = node.first_edge();
loop {
res += dfs(edge.reborrow().descend());
match edge.right_kv() {
Ok(right_kv) => {
edge = right_kv.right_edge();
}
Err(_) => {
break;
}
}
}
}

res
}

self.length = dfs(self.root.as_ref().unwrap().node_as_ref());
}

/// Creates a consuming iterator visiting all the keys, in sorted order.
/// The map cannot be used after calling this.
/// The iterator element type is `K`.
Expand Down
Loading