diff options
Diffstat (limited to 'tests/ui/type-alias-impl-trait/issue-90400-1.rs')
-rw-r--r-- | tests/ui/type-alias-impl-trait/issue-90400-1.rs | 29 |
1 files changed, 29 insertions, 0 deletions
diff --git a/tests/ui/type-alias-impl-trait/issue-90400-1.rs b/tests/ui/type-alias-impl-trait/issue-90400-1.rs new file mode 100644 index 000000000..15aead2f6 --- /dev/null +++ b/tests/ui/type-alias-impl-trait/issue-90400-1.rs @@ -0,0 +1,29 @@ +// Regression test for #90400, +// taken from https://github.com/rust-lang/rust/issues/90400#issuecomment-954927836 + +#![feature(type_alias_impl_trait)] + +trait Bar { + fn bar(&self); +} + +trait Foo { + type FooFn<B>: FnOnce(); + + fn foo<B: Bar>(&self, bar: B) -> Self::FooFn<B>; +} + +struct MyFoo; + +impl Foo for MyFoo { + type FooFn<B> = impl FnOnce(); + + fn foo<B: Bar>(&self, bar: B) -> Self::FooFn<B> { + move || bar.bar() //~ ERROR: the trait bound `B: Bar` is not satisfied + } +} + +fn main() { + let boom: <MyFoo as Foo>::FooFn<u32> = unsafe { core::mem::zeroed() }; + boom(); +} |