mirror of
https://github.com/rust-lang/rust.git
synced 2024-11-23 15:23:46 +00:00
21 lines
316 B
Rust
21 lines
316 B
Rust
#[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);
|
|
}
|