]> git.proxmox.com Git - rustc.git/blame - src/test/ui/rfcs/rfc-2396-target_feature-11/fn-traits.rs
New upstream version 1.48.0~beta.8+dfsg1
[rustc.git] / src / test / ui / rfcs / rfc-2396-target_feature-11 / fn-traits.rs
CommitLineData
f035d41b
XL
1// only-x86_64
2
3#![feature(target_feature_11)]
4
5#[target_feature(enable = "avx")]
6fn foo() {}
7
8#[target_feature(enable = "avx")]
9unsafe fn foo_unsafe() {}
10
11fn call(f: impl Fn()) {
12 f()
13}
14
15fn call_mut(f: impl FnMut()) {
16 f()
17}
18
19fn call_once(f: impl FnOnce()) {
20 f()
21}
22
23fn main() {
1b1a35ee
XL
24 call(foo); //~ ERROR expected a `Fn<()>` closure, found `fn() {foo}`
25 call_mut(foo); //~ ERROR expected a `FnMut<()>` closure, found `fn() {foo}`
26 call_once(foo); //~ ERROR expected a `FnOnce<()>` closure, found `fn() {foo}`
f035d41b
XL
27
28 call(foo_unsafe);
1b1a35ee 29 //~^ ERROR expected a `Fn<()>` closure, found `unsafe fn() {foo_unsafe}`
f035d41b 30 call_mut(foo_unsafe);
1b1a35ee 31 //~^ ERROR expected a `FnMut<()>` closure, found `unsafe fn() {foo_unsafe}`
f035d41b 32 call_once(foo_unsafe);
1b1a35ee 33 //~^ ERROR expected a `FnOnce<()>` closure, found `unsafe fn() {foo_unsafe}`
f035d41b 34}