mirror of
https://github.com/rust-lang/rust.git
synced 2024-11-30 10:45:18 +00:00
19 lines
219 B
Rust
19 lines
219 B
Rust
// run-pass
|
|
|
|
trait Foo {
|
|
fn a(&self) -> isize;
|
|
fn b(&self) -> isize {
|
|
self.a() + 2
|
|
}
|
|
}
|
|
|
|
impl Foo for isize {
|
|
fn a(&self) -> isize {
|
|
3
|
|
}
|
|
}
|
|
|
|
pub fn main() {
|
|
assert_eq!(3.b(), 5);
|
|
}
|