diff options
Diffstat (limited to 'tests/ui/chalkify/projection.rs')
-rw-r--r-- | tests/ui/chalkify/projection.rs | 25 |
1 files changed, 25 insertions, 0 deletions
diff --git a/tests/ui/chalkify/projection.rs b/tests/ui/chalkify/projection.rs new file mode 100644 index 000000000..19bb2ae14 --- /dev/null +++ b/tests/ui/chalkify/projection.rs @@ -0,0 +1,25 @@ +// run-pass +// compile-flags: -Z trait-solver=chalk + +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>(); +} |