about summary refs log tree commit diff
path: root/tests/ui/suggestions/clone-bounds-121524.rs
blob: b7760584ebbc2f23f5e244d4124a41ee075918f9 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
#[derive(Clone)]
struct ThingThatDoesAThing;

trait DoesAThing {}

impl DoesAThing for ThingThatDoesAThing {}

fn clones_impl_ref_inline(thing: &impl DoesAThing) {
    //~^ HELP consider restricting opaque type `impl DoesAThing` with trait `Clone`
    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);
}