2018-08-30 07:18:55 -05:00
|
|
|
// run-pass
|
2017-11-23 15:03:47 -06:00
|
|
|
use std::iter::{Fuse, Cloned};
|
|
|
|
use std::slice::Iter;
|
|
|
|
|
2022-07-25 15:36:03 -05:00
|
|
|
struct Foo<'a, T: 'a>(#[allow(unused_tuple_struct_fields)] &'a T);
|
2017-11-23 15:03:47 -06:00
|
|
|
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() {
|
2019-06-17 05:52:37 -05:00
|
|
|
let _f: *mut <Fuse<Cloned<Iter<u8>>> as Iterator>::Item = std::ptr::null_mut();
|
2017-11-23 15:03:47 -06:00
|
|
|
|
|
|
|
copy_ex();
|
|
|
|
}
|