diff options
Diffstat (limited to 'tests/ui/type-alias-impl-trait/wf-check-fn-def.rs')
-rw-r--r-- | tests/ui/type-alias-impl-trait/wf-check-fn-def.rs | 18 |
1 files changed, 18 insertions, 0 deletions
diff --git a/tests/ui/type-alias-impl-trait/wf-check-fn-def.rs b/tests/ui/type-alias-impl-trait/wf-check-fn-def.rs new file mode 100644 index 000000000..449e9fbd0 --- /dev/null +++ b/tests/ui/type-alias-impl-trait/wf-check-fn-def.rs @@ -0,0 +1,18 @@ +#![feature(type_alias_impl_trait)] + +trait Bar { + fn bar(&self); +} + +type FooFn<B> = impl FnOnce(B); + +fn foo<B: Bar>() -> FooFn<B> { + fn mop<B: Bar>(bar: B) { bar.bar() } + mop // NOTE: no function pointer, but function zst item + //~^ ERROR the trait bound `B: Bar` is not satisfied +} + +fn main() { + let boom: FooFn<u32> = unsafe { core::mem::zeroed() }; + boom(42); +} |