File tree Expand file tree Collapse file tree 2 files changed +26
-0
lines changed
tests/ui/consts/const-eval Expand file tree Collapse file tree 2 files changed +26
-0
lines changed Original file line number Diff line number Diff line change 1+ // only-x86_64
2+ // compile-flags:-C target-feature=+ssse3
3+
4+ #![ crate_type = "lib" ]
5+
6+ // ok (ssse3 enabled at compile time)
7+ const A : ( ) = unsafe { ssse3_fn ( ) } ;
8+
9+ // error (avx2 not enabled at compile time)
10+ const B : ( ) = unsafe { avx2_fn ( ) } ;
11+ //~^ ERROR evaluation of constant value failed
12+
13+ #[ target_feature( enable = "ssse3" ) ]
14+ const unsafe fn ssse3_fn ( ) { }
15+
16+ #[ target_feature( enable = "avx2" ) ]
17+ const unsafe fn avx2_fn ( ) { }
Original file line number Diff line number Diff line change 1+ error[E0080]: evaluation of constant value failed
2+ --> $DIR/const_fn_target_feature.rs:10:24
3+ |
4+ LL | const B: () = unsafe { avx2_fn() };
5+ | ^^^^^^^^^ calling a function that requires unavailable target features: avx2
6+
7+ error: aborting due to previous error
8+
9+ For more information about this error, try `rustc --explain E0080`.
You can’t perform that action at this time.
0 commit comments