mirror of
https://github.com/rust-lang/rust.git
synced 2024-11-23 23:34:48 +00:00
27 lines
357 B
Rust
27 lines
357 B
Rust
trait Foo<A> {
|
|
fn foo(&self, a: A) -> A {
|
|
a
|
|
}
|
|
}
|
|
|
|
trait NotRelevant<A> {
|
|
fn nr(&self, a: A) -> A {
|
|
a
|
|
}
|
|
}
|
|
|
|
struct Bar;
|
|
|
|
impl Foo<i32> for Bar {}
|
|
|
|
impl Foo<u8> for Bar {}
|
|
|
|
impl NotRelevant<usize> for Bar {}
|
|
|
|
fn main() {
|
|
let f1 = Bar;
|
|
|
|
f1.foo(1usize);
|
|
//~^ error: the trait bound `Bar: Foo<usize>` is not satisfied
|
|
}
|