Add a test for BTreeMap lifetime bound to see if it compiles

This commit is contained in:
Nazım Can Altınova 2020-08-05 23:07:10 +02:00
parent 62e06a4d09
commit cedf96c834
No known key found for this signature in database
GPG Key ID: 722E786F0729647A
1 changed files with 23 additions and 0 deletions

View File

@ -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() {}