mirror of
https://github.com/rust-lang/rust.git
synced 2024-11-25 16:24:46 +00:00
24 lines
271 B
Rust
24 lines
271 B
Rust
#[derive(Clone)]
|
|
struct S;
|
|
|
|
// without Clone
|
|
struct T;
|
|
|
|
fn foo(_: S) {}
|
|
|
|
fn test1() {
|
|
let s = &S;
|
|
foo(s); //~ ERROR mismatched types
|
|
}
|
|
|
|
fn bar(_: T) {}
|
|
fn test2() {
|
|
let t = &T;
|
|
bar(t); //~ ERROR mismatched types
|
|
}
|
|
|
|
fn main() {
|
|
test1();
|
|
test2();
|
|
}
|