1 // Check that one cannot subvert Drop Check rule via a user-defined
2 // Clone implementation.
4 #![allow(unused_variables, unused_assignments)]
6 struct D<T:Copy>(T, &'static str);
9 struct S<'a>(&'a D<i32>, &'static str);
10 impl<'a> Clone for S<'a> {
11 fn clone(&self) -> S<'a> {
12 println!("cloning `S(_, {})` and thus accessing: {}", self.1, (self.0).0);
17 impl<T:Copy> Drop for D<T> {
19 println!("calling Drop for {}", self.1);
20 let _call = self.0.clone();
27 d2 = D(S(&d1, "inner"), "d2");
29 //~^^ ERROR `d1` does not live long enough