rust/tests/ui/chalkify/projection.rs

Ignoring revisions in .git-blame-ignore-revs. Click here to bypass and see the normal blame view.

26 lines
401 B
Rust
Raw Normal View History

2020-03-03 10:25:03 -06:00
// run-pass
2023-01-02 17:18:00 -06:00
// compile-flags: -Z trait-solver=chalk
2020-03-03 10:25:03 -06:00
trait Foo { }
trait Bar {
type Item: Foo;
}
impl Foo for i32 { }
impl Bar for i32 {
type Item = i32;
}
fn only_foo<T: Foo>() { }
fn only_bar<T: Bar>() {
// `T` implements `Bar` hence `<T as Bar>::Item` must also implement `Bar`
only_foo::<T::Item>()
}
fn main() {
only_bar::<i32>();
only_foo::<<i32 as Bar>::Item>();
}