summaryrefslogtreecommitdiffstats
path: root/tests/ui/typeck/explain_clone_autoref.rs
blob: 4d21574700ad987e663a216dd1bb0fe5e232dac5 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
struct NotClone;

fn main() {
    clone_thing(&NotClone);
}

fn clone_thing(nc: &NotClone) -> NotClone {
    //~^ NOTE expected `NotClone` because of return type
    nc.clone()
    //~^ ERROR mismatched type
    //~| NOTE `NotClone` does not implement `Clone`, so `&NotClone` was cloned instead
    //~| NOTE expected `NotClone`, found `&NotClone`
}