about summary refs log tree commit diff
path: root/tests/run-make/wasm-unexpected-features/rmake.rs
blob: 01eff54e823c9cca9aeedac32c9ec376a9a2a276 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
//@ only-wasm32-wasip1

use std::path::Path;

use run_make_support::{rfs, rustc, wasmparser};

fn main() {
    rustc()
        .input("foo.rs")
        .target("wasm32-wasip1")
        .target_cpu("mvp")
        .opt_level("z")
        .lto("fat")
        .linker_plugin_lto("on")
        .link_arg("--import-memory")
        .run();
    verify_features(Path::new("foo.wasm"));
}

fn verify_features(path: &Path) {
    eprintln!("verify {path:?}");
    let file = rfs::read(&path);

    let mut validator = wasmparser::Validator::new_with_features(wasmparser::WasmFeatures::MVP);
    validator.validate_all(&file).unwrap();
}