summaryrefslogtreecommitdiffstats
path: root/tests/ui/suggestions/issue-106443-sugg-clone-for-bound.rs
blob: 3b2e316b2961e7d3e2e437ebb8eb0a550c1d9286 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
#[derive(Clone)]
struct S;

trait X {}

impl X for S {}

fn foo<T: X>(_: T) {}
fn bar<T: X>(s: &T) {
    foo(s); //~ ERROR the trait bound `&T: X` is not satisfied
}

fn bar_with_clone<T: X + Clone>(s: &T) {
    foo(s); //~ ERROR the trait bound `&T: X` is not satisfied
}

fn main() {
    let s = &S;
    bar(s);
}