diff options
| author | Guillaume Gomez <guillaume1.gomez@gmail.com> | 2023-10-14 22:35:05 +0200 |
|---|---|---|
| committer | GitHub <noreply@github.com> | 2023-10-14 22:35:05 +0200 |
| commit | 03cbf50c343c1a6aa71689c8dfc09bd9f68c1374 (patch) | |
| tree | f226140b48c9e1e7a3c24ed2a54aa2a5e2ab7b46 /tests | |
| parent | fcd75ccc90c23a7d669929e983c47ac0157a6d69 (diff) | |
| parent | f9b1af65871f7f7d3b4b782527dba052a4dce161 (diff) | |
| download | rust-03cbf50c343c1a6aa71689c8dfc09bd9f68c1374.tar.gz rust-03cbf50c343c1a6aa71689c8dfc09bd9f68c1374.zip | |
Rollup merge of #116576 - eduardosm:const-eval-wasm-target-features, r=RalfJung
const-eval: allow calling functions with targat features disabled at compile time in WASM This is not unsafe on WASM, see https://github.com/rust-lang/rust/pull/84988 r? `@RalfJung` Fixes https://github.com/rust-lang/rust/issues/116516
Diffstat (limited to 'tests')
| -rw-r--r-- | tests/ui/consts/const-eval/const_fn_target_feature_wasm.rs | 14 |
1 files changed, 14 insertions, 0 deletions
diff --git a/tests/ui/consts/const-eval/const_fn_target_feature_wasm.rs b/tests/ui/consts/const-eval/const_fn_target_feature_wasm.rs new file mode 100644 index 00000000000..c1460fdd9ec --- /dev/null +++ b/tests/ui/consts/const-eval/const_fn_target_feature_wasm.rs @@ -0,0 +1,14 @@ +// only-wasm32 +// compile-flags:-C target-feature=-simd128 +// build-pass + +#![crate_type = "lib"] + +#[cfg(target_feature = "simd128")] +compile_error!("simd128 target feature should be disabled"); + +// Calling functions with `#[target_feature]` is not unsound on WASM, see #84988 +const A: () = simd128_fn(); + +#[target_feature(enable = "simd128")] +const fn simd128_fn() {} |
