]> git.proxmox.com Git - rustc.git/blob - src/test/ui/type-alias-impl-trait/wf-check-fn-ptrs.rs
Update unsuspicious file list
[rustc.git] / src / test / ui / type-alias-impl-trait / wf-check-fn-ptrs.rs
1 #![feature(type_alias_impl_trait)]
2
3 // build-pass
4
5 trait Bar {
6 fn bar(&self);
7 }
8
9 type FooFn<B> = impl FnOnce(B);
10
11 fn foo<B: Bar>() -> FooFn<B> {
12 fn mop<B: Bar>(bar: B) { bar.bar() }
13 mop as fn(B)
14 // function pointers don't have any obligations on them,
15 // thus the above compiles. It's obviously unsound to just
16 // procure a `FooFn` from the ether without making sure that
17 // the pointer is actually legal for all `B`
18 }
19
20 fn main() {
21 let boom: FooFn<u32> = unsafe { core::mem::zeroed() };
22 boom(42);
23 }