]> git.lizzy.rs Git - rust.git/blob - tests/ui/type-alias-impl-trait/issue-90400-1.rs
Rollup merge of #106716 - c410-f3r:rfc-2397-1, r=davidtwco
[rust.git] / tests / ui / type-alias-impl-trait / issue-90400-1.rs
1 // Regression test for #90400,
2 // taken from https://github.com/rust-lang/rust/issues/90400#issuecomment-954927836
3
4 #![feature(type_alias_impl_trait)]
5
6 trait Bar {
7     fn bar(&self);
8 }
9
10 trait Foo {
11     type FooFn<B>: FnOnce();
12
13     fn foo<B: Bar>(&self, bar: B) -> Self::FooFn<B>;
14 }
15
16 struct MyFoo;
17
18 impl Foo for MyFoo {
19     type FooFn<B> = impl FnOnce();
20
21     fn foo<B: Bar>(&self, bar: B) -> Self::FooFn<B> {
22         move || bar.bar() //~ ERROR: the trait bound `B: Bar` is not satisfied
23     }
24 }
25
26 fn main() {
27     let boom: <MyFoo as Foo>::FooFn<u32> = unsafe { core::mem::zeroed() };
28     boom();
29 }