Skip to content

Commit f678fac

Browse files
authored
Rollup merge of rust-lang#51914 - nikomatsakis:nll-fix-issue-issue-btreemap-annotations, r=gankro
add outlives annotations to `BTreeMap` NLL requires these annotations, I believe because of <rust-lang#29149>. Fixes rust-lang#48224 r? @gankro cc @lqd
2 parents 80016fd + 59f2edb commit f678fac

File tree

1 file changed

+10
-7
lines changed
  • src/liballoc/collections/btree

1 file changed

+10
-7
lines changed

src/liballoc/collections/btree/map.rs

+10-7
Original file line numberDiff line numberDiff line change
@@ -149,12 +149,11 @@ unsafe impl<#[may_dangle] K, #[may_dangle] V> Drop for BTreeMap<K, V> {
149149
#[stable(feature = "rust1", since = "1.0.0")]
150150
impl<K: Clone, V: Clone> Clone for BTreeMap<K, V> {
151151
fn clone(&self) -> BTreeMap<K, V> {
152-
fn clone_subtree<K: Clone, V: Clone>(node: node::NodeRef<marker::Immut,
153-
K,
154-
V,
155-
marker::LeafOrInternal>)
156-
-> BTreeMap<K, V> {
157-
152+
fn clone_subtree<'a, K: Clone, V: Clone>(
153+
node: node::NodeRef<marker::Immut<'a>, K, V, marker::LeafOrInternal>
154+
) -> BTreeMap<K, V>
155+
where K: 'a, V: 'a,
156+
{
158157
match node.force() {
159158
Leaf(leaf) => {
160159
let mut out_tree = BTreeMap {
@@ -1080,7 +1079,11 @@ impl<K: Ord, V> BTreeMap<K, V> {
10801079

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

10861089
if let Internal(node) = node.force() {

0 commit comments

Comments
 (0)