about summary refs log tree commit diff
diff options
context:
space:
mode:
authorMazdak Farrokhzad <twingoow@gmail.com>2019-08-15 14:34:07 +0200
committerGitHub <noreply@github.com>2019-08-15 14:34:07 +0200
commit77f2694fdc7fb469511e0ca485c164b9ef66f64f (patch)
tree141b97126c881a695081293b65a35e8534e3f990
parentb1bbd52a59462c635c7cece92c2212df52da5adc (diff)
parente5017dec58b73182b21d3dc0b6c93590716d8cc4 (diff)
downloadrust-77f2694fdc7fb469511e0ca485c164b9ef66f64f.tar.gz
rust-77f2694fdc7fb469511e0ca485c164b9ef66f64f.zip
Rollup merge of #63577 - meffij:test-hrtb, r=alexcrichton
Test HRTB issue accepted by compiler

Hi! First Rust PR, so if anything needs changing just let me know and I'll take care of it right away.

Closes #50301 which was marked E-needstest
-rw-r--r--src/test/ui/issues/issue-50301.rs31
1 files changed, 31 insertions, 0 deletions
diff --git a/src/test/ui/issues/issue-50301.rs b/src/test/ui/issues/issue-50301.rs
new file mode 100644
index 00000000000..47ee3e7ad70
--- /dev/null
+++ b/src/test/ui/issues/issue-50301.rs
@@ -0,0 +1,31 @@
+// Tests that HRTBs are correctly accepted -- https://github.com/rust-lang/rust/issues/50301
+// check-pass
+trait Trait
+where
+    for<'a> &'a Self::IntoIter: IntoIterator<Item = u32>,
+{
+    type IntoIter;
+    fn get(&self) -> Self::IntoIter;
+}
+
+struct Impl(Vec<u32>);
+
+impl Trait for Impl {
+    type IntoIter = ImplIntoIter;
+    fn get(&self) -> Self::IntoIter {
+        ImplIntoIter(self.0.clone())
+    }
+}
+
+struct ImplIntoIter(Vec<u32>);
+
+impl<'a> IntoIterator for &'a ImplIntoIter {
+    type Item = <Self::IntoIter as Iterator>::Item;
+    type IntoIter = std::iter::Cloned<std::slice::Iter<'a, u32>>;
+    fn into_iter(self) -> Self::IntoIter {
+        (&self.0).into_iter().cloned()
+    }
+}
+
+fn main() {
+}