Skip to content

Commit

Permalink
const-eval: allow calling functions with targat features disabled at …
Browse files Browse the repository at this point in the history
…compile time in WASM

This is not unsafe on WASM, see rust-lang/rust#84988
  • Loading branch information
eduardosm committed Oct 14, 2023
1 parent edb8438 commit 001f789
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 2 deletions.
4 changes: 2 additions & 2 deletions ci.sh
Original file line number Diff line number Diff line change
Expand Up @@ -110,8 +110,8 @@ case $HOST_TARGET in
MIRI_TEST_TARGET=i686-pc-windows-gnu run_tests
MIRI_TEST_TARGET=x86_64-unknown-freebsd run_tests_minimal hello integer vec panic/panic concurrency/simple atomic data_race env/var
MIRI_TEST_TARGET=aarch64-linux-android run_tests_minimal hello integer vec panic/panic
MIRI_TEST_TARGET=wasm32-wasi run_tests_minimal no_std integer strings
MIRI_TEST_TARGET=wasm32-unknown-unknown run_tests_minimal no_std integer strings
MIRI_TEST_TARGET=wasm32-wasi run_tests_minimal no_std integer strings wasm
MIRI_TEST_TARGET=wasm32-unknown-unknown run_tests_minimal no_std integer strings wasm
MIRI_TEST_TARGET=thumbv7em-none-eabihf run_tests_minimal no_std # no_std embedded architecture
MIRI_TEST_TARGET=tests/avr.json MIRI_NO_STD=1 run_tests_minimal no_std # JSON target file
;;
Expand Down
11 changes: 11 additions & 0 deletions tests/pass/function_calls/target_feature_wasm.rs
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
//@only-target-wasm32: tests WASM-specific behavior
//@compile-flags: -C target-feature=-simd128

fn main() {
// Calling functions with `#[target_feature]` is not unsound on WASM, see #84988
assert!(!cfg!(target_feature = "simd128"));
simd128_fn();
}

#[target_feature(enable = "simd128")]
fn simd128_fn() {}

0 comments on commit 001f789

Please sign in to comment.