mirror of
https://github.com/rust-lang/rust.git
synced 2024-11-23 15:23:46 +00:00
27 lines
375 B
Rust
27 lines
375 B
Rust
//@ run-pass
|
|
|
|
mod a {
|
|
pub trait Foo {
|
|
fn foo() -> Self;
|
|
}
|
|
|
|
impl Foo for isize {
|
|
fn foo() -> isize {
|
|
3
|
|
}
|
|
}
|
|
|
|
impl Foo for usize {
|
|
fn foo() -> usize {
|
|
5
|
|
}
|
|
}
|
|
}
|
|
|
|
pub fn main() {
|
|
let x: isize = a::Foo::foo();
|
|
let y: usize = a::Foo::foo();
|
|
assert_eq!(x, 3);
|
|
assert_eq!(y, 5);
|
|
}
|