mirror of
https://github.com/rust-lang/rust.git
synced 2025-05-06 23:17:37 +00:00
20 lines
291 B
Rust
20 lines
291 B
Rust
![]() |
// run-pass
|
||
|
// compile-flags: -Z chalk
|
||
|
|
||
|
trait Foo { }
|
||
|
trait Bar: Foo { }
|
||
|
|
||
|
impl Foo for i32 { }
|
||
|
impl Bar for i32 { }
|
||
|
|
||
|
fn only_foo<T: Foo>() { }
|
||
|
|
||
|
fn only_bar<T: Bar>() {
|
||
|
// `T` implements `Bar` hence `T` must also implement `Foo`
|
||
|
only_foo::<T>()
|
||
|
}
|
||
|
|
||
|
fn main() {
|
||
|
only_bar::<i32>()
|
||
|
}
|