mirror of
https://github.com/rust-lang/rust.git
synced 2024-11-23 15:23:46 +00:00
19 lines
238 B
Rust
19 lines
238 B
Rust
trait MyTrait {
|
|
fn get(&self) -> usize;
|
|
}
|
|
|
|
impl<T> MyTrait for T {
|
|
fn get(&self) -> usize { 0 }
|
|
}
|
|
|
|
struct Foo {
|
|
value: usize
|
|
}
|
|
|
|
impl MyTrait for Foo { //~ ERROR E0119
|
|
fn get(&self) -> usize { self.value }
|
|
}
|
|
|
|
fn main() {
|
|
}
|