]> git.lizzy.rs Git - rust.git/commitdiff
add outlives annotations to `BTreeMap`
authorNiko Matsakis <niko@alum.mit.edu>
Tue, 20 Feb 2018 15:26:48 +0000 (10:26 -0500)
committerNiko Matsakis <niko@alum.mit.edu>
Mon, 2 Jul 2018 15:49:33 +0000 (11:49 -0400)
nll requires these annotations, I believe because of
https://github.com/rust-lang/rust/issues/29149

src/liballoc/collections/btree/map.rs

index 2aad3149bb2110556729dc2b0e57f77e1f669738..8c950cd06d9e385373f56175d5253060c4e8390a 100644 (file)
@@ -149,12 +149,11 @@ fn drop(&mut self) {
 #[stable(feature = "rust1", since = "1.0.0")]
 impl<K: Clone, V: Clone> Clone for BTreeMap<K, V> {
     fn clone(&self) -> BTreeMap<K, V> {
-        fn clone_subtree<K: Clone, V: Clone>(node: node::NodeRef<marker::Immut,
-                                                                 K,
-                                                                 V,
-                                                                 marker::LeafOrInternal>)
-                                             -> BTreeMap<K, V> {
-
+        fn clone_subtree<'a, K: Clone, V: Clone>(
+            node: node::NodeRef<marker::Immut<'a>, K, V, marker::LeafOrInternal>
+        ) -> BTreeMap<K, V>
+        where K: 'a, V: 'a,
+        {
             match node.force() {
                 Leaf(leaf) => {
                     let mut out_tree = BTreeMap {
@@ -1080,7 +1079,11 @@ pub fn split_off<Q: ?Sized + Ord>(&mut self, key: &Q) -> Self
 
     /// Calculates the number of elements if it is incorrect.
     fn recalc_length(&mut self) {
-        fn dfs<K, V>(node: NodeRef<marker::Immut, K, V, marker::LeafOrInternal>) -> usize {
+        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() {