]> git.lizzy.rs Git - rust.git/blob - tests/ui/target-feature/wasm-safe.rs
Move /src/test to /tests
[rust.git] / tests / ui / target-feature / wasm-safe.rs
1 // only-wasm32
2 // check-pass
3
4 #![feature(wasm_target_feature)]
5 #![allow(dead_code)]
6
7 #[target_feature(enable = "nontrapping-fptoint")]
8 fn foo() {}
9
10 #[target_feature(enable = "nontrapping-fptoint")]
11 extern "C" fn bar() {}
12
13 trait A {
14     fn foo();
15     fn bar(&self);
16 }
17
18 struct B;
19
20 impl B {
21     #[target_feature(enable = "nontrapping-fptoint")]
22     fn foo() {}
23     #[target_feature(enable = "nontrapping-fptoint")]
24     fn bar(&self) {}
25 }
26
27 impl A for B {
28     #[target_feature(enable = "nontrapping-fptoint")]
29     fn foo() {}
30     #[target_feature(enable = "nontrapping-fptoint")]
31     fn bar(&self) {}
32 }
33
34 fn no_features_enabled_on_this_function() {
35     bar();
36     foo();
37     B.bar();
38     B::foo();
39     <B as A>::foo();
40     <B as A>::bar(&B);
41 }
42
43 #[target_feature(enable = "nontrapping-fptoint")]
44 fn main() {}