rust/src/test/ui/issues/issue-25700.rs
2022-08-03 12:17:23 +02:00

15 lines
387 B
Rust

struct S<T: 'static>(#[allow(unused_tuple_struct_fields)] Option<&'static T>);
trait Tr { type Out; }
impl<T> Tr for T { type Out = T; }
impl<T: 'static> Copy for S<T> where S<T>: Tr<Out=T> {}
impl<T: 'static> Clone for S<T> where S<T>: Tr<Out=T> {
fn clone(&self) -> Self { *self }
}
fn main() {
let t = S::<()>(None);
drop(t);
drop(t); //~ ERROR use of moved value
}