Skip to content

Commit

Permalink
Rollup merge of rust-lang#51914 - nikomatsakis:nll-fix-issue-issue-bt…
Browse files Browse the repository at this point in the history
…reemap-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
  • Loading branch information
Mark-Simulacrum authored Jul 2, 2018
2 parents 980b799 + 59f2edb commit 58e0cff
Showing 1 changed file with 10 additions and 7 deletions.
17 changes: 10 additions & 7 deletions src/liballoc/collections/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 @@ -1080,7 +1079,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 58e0cff

Please sign in to comment.