rust/tests/ui/suggestions/issue-106443-sugg-clone-for-bound.rs

Ignoring revisions in .git-blame-ignore-revs. Click here to bypass and see the normal blame view.

21 lines
316 B
Rust
Raw Normal View History

2023-01-02 23:27:49 -06:00
#[derive(Clone)]
struct S;
trait X {}
impl X for S {}
fn foo<T: X>(_: T) {}
fn bar<T: X>(s: &T) {
2023-01-02 23:27:49 -06:00
foo(s); //~ ERROR the trait bound `&T: X` is not satisfied
}
fn bar_with_clone<T: X + Clone>(s: &T) {
2023-01-02 23:27:49 -06:00
foo(s); //~ ERROR the trait bound `&T: X` is not satisfied
}
fn main() {
let s = &S;
bar(s);
}