Skip to content

Commit

Permalink
Add a test for BTreeMap lifetime bound to see if it compiles
Browse files Browse the repository at this point in the history
  • Loading branch information
canova committed Aug 5, 2020
1 parent 62e06a4 commit cedf96c
Showing 1 changed file with 23 additions and 0 deletions.
23 changes: 23 additions & 0 deletions src/test/ui/btreemap/btreemap_into_iterator_lifetime.rs
@@ -0,0 +1,23 @@
// check-pass

use std::collections::{BTreeMap, HashMap};

trait Map
where
for<'a> &'a Self: IntoIterator<Item = (&'a Self::Key, &'a Self::Value)>,
{
type Key;
type Value;
}

impl<K, V> Map for HashMap<K, V> {
type Key = K;
type Value = V;
}

impl<K, V> Map for BTreeMap<K, V> {
type Key = K;
type Value = V;
}

fn main() {}

0 comments on commit cedf96c

Please sign in to comment.