2024-03-07 20:01:28 -07:00
|
|
|
#[derive(Clone)]
|
|
|
|
|
struct ThingThatDoesAThing;
|
|
|
|
|
|
|
|
|
|
trait DoesAThing {}
|
|
|
|
|
|
|
|
|
|
impl DoesAThing for ThingThatDoesAThing {}
|
|
|
|
|
|
|
|
|
|
fn clones_impl_ref_inline(thing: &impl DoesAThing) {
|
2024-11-28 22:20:44 +00:00
|
|
|
//~^ HELP consider restricting opaque type `impl DoesAThing` with trait `Clone`
|
2024-03-07 20:01:28 -07:00
|
|
|
drops_impl_owned(thing.clone()); //~ ERROR E0277
|
|
|
|
|
//~^ NOTE copies the reference
|
|
|
|
|
//~| NOTE the trait `DoesAThing` is not implemented for `&impl DoesAThing`
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
fn drops_impl_owned(_thing: impl DoesAThing) { }
|
|
|
|
|
|
|
|
|
|
fn main() {
|
|
|
|
|
clones_impl_ref_inline(&ThingThatDoesAThing);
|
|
|
|
|
}
|