about summary refs log tree commit diff
diff options
context:
space:
mode:
authorNazım Can Altınova <canaltinova@gmail.com>2020-08-05 23:07:10 +0200
committerNazım Can Altınova <canaltinova@gmail.com>2020-08-05 23:44:34 +0200
commitcedf96c834372074b1c56869155744a3bfef6fe4 (patch)
treee23e2b56498aebcf9f53eb4f13d00543984bfd60
parent62e06a4d09f5114405856df0380f4f623e9a3812 (diff)
downloadrust-cedf96c834372074b1c56869155744a3bfef6fe4.tar.gz
rust-cedf96c834372074b1c56869155744a3bfef6fe4.zip
Add a test for BTreeMap lifetime bound to see if it compiles
-rw-r--r--src/test/ui/btreemap/btreemap_into_iterator_lifetime.rs23
1 files changed, 23 insertions, 0 deletions
diff --git a/src/test/ui/btreemap/btreemap_into_iterator_lifetime.rs b/src/test/ui/btreemap/btreemap_into_iterator_lifetime.rs
new file mode 100644
index 00000000000..fda825bc65e
--- /dev/null
+++ b/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() {}