Skip to content

Commit

Permalink
add outlives annotations to BTreeMap
Browse files Browse the repository at this point in the history
nll requires these annotations, I believe because of
rust-lang#29149
  • Loading branch information
nikomatsakis committed Mar 19, 2018
1 parent a04b88d commit 76bef34
Showing 1 changed file with 10 additions and 7 deletions.
17 changes: 10 additions & 7 deletions src/liballoc/btree/map.rs
Original file line number Diff line number Diff line change
Expand Up @@ -149,12 +149,11 @@ unsafe impl<#[may_dangle] K, #[may_dangle] V> Drop for BTreeMap<K, V> {
#[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 {
Expand Down Expand Up @@ -1040,7 +1039,11 @@ impl<K: Ord, V> BTreeMap<K, V> {

/// 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() {
Expand Down

0 comments on commit 76bef34

Please sign in to comment.