summaryrefslogtreecommitdiffstats
path: root/tests/ui/issues/issue-46069.rs
diff options
context:
space:
mode:
Diffstat (limited to 'tests/ui/issues/issue-46069.rs')
-rw-r--r--tests/ui/issues/issue-46069.rs23
1 files changed, 23 insertions, 0 deletions
diff --git a/tests/ui/issues/issue-46069.rs b/tests/ui/issues/issue-46069.rs
new file mode 100644
index 000000000..c418128c1
--- /dev/null
+++ b/tests/ui/issues/issue-46069.rs
@@ -0,0 +1,23 @@
+// run-pass
+use std::iter::{Fuse, Cloned};
+use std::slice::Iter;
+
+struct Foo<'a, T: 'a>(#[allow(unused_tuple_struct_fields)] &'a T);
+impl<'a, T: 'a> Copy for Foo<'a, T> {}
+impl<'a, T: 'a> Clone for Foo<'a, T> {
+ fn clone(&self) -> Self { *self }
+}
+
+fn copy_ex() {
+ let s = 2;
+ let k1 = || s;
+ let upvar = Foo(&k1);
+ let k = || upvar;
+ k();
+}
+
+fn main() {
+ let _f: *mut <Fuse<Cloned<Iter<u8>>> as Iterator>::Item = std::ptr::null_mut();
+
+ copy_ex();
+}