summaryrefslogtreecommitdiffstats
path: root/src/test/ui/issues/issue-46069.rs
blob: c418128c1866fe00edf37e953a355c954e359ef6 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
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();
}