Skip to content

Commit 3a250b7

Browse files
rewrite test with #![no_core]
1 parent f978932 commit 3a250b7

File tree

4 files changed

+53
-69
lines changed

4 files changed

+53
-69
lines changed
Lines changed: 43 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,43 @@
1+
#![no_core]
2+
#![crate_type = "cdylib"]
3+
#![feature(no_core, lang_items, allocator_internals, rustc_attrs)]
4+
#![needs_allocator]
5+
#![allow(internal_features)]
6+
7+
#[rustc_std_internal_symbol]
8+
unsafe fn __rust_alloc(_size: usize, _align: usize) -> *mut u8 {
9+
0 as *mut u8
10+
}
11+
12+
unsafe extern "Rust" {
13+
#[rustc_std_internal_symbol]
14+
fn __rust_alloc_error_handler(size: usize, align: usize) -> !;
15+
}
16+
17+
#[used]
18+
static mut BUF: [u8; 1024] = [0; 1024];
19+
20+
#[unsafe(no_mangle)]
21+
extern "C" fn init() {
22+
unsafe {
23+
__rust_alloc_error_handler(0, 0);
24+
}
25+
}
26+
27+
mod minicore {
28+
#[lang = "pointee_sized"]
29+
pub trait PointeeSized {}
30+
31+
#[lang = "meta_sized"]
32+
pub trait MetaSized: PointeeSized {}
33+
34+
#[lang = "sized"]
35+
pub trait Sized: MetaSized {}
36+
37+
#[lang = "copy"]
38+
pub trait Copy {}
39+
impl Copy for u8 {}
40+
41+
#[lang = "drop_in_place"]
42+
fn drop_in_place<T>(_: *mut T) {}
43+
}

tests/run-make/wasm-unexpected-features/rmake.rs

Lines changed: 10 additions & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -2,31 +2,19 @@
22

33
use std::path::Path;
44

5-
use run_make_support::{cargo, path, rfs, target, wasmparser};
5+
use run_make_support::{rfs, rustc, wasmparser};
66

77
fn main() {
8-
let target_dir = path("target");
9-
10-
cargo()
11-
.args([
12-
"rustc",
13-
"--manifest-path",
14-
"wasm32_test/Cargo.toml",
15-
"--profile",
16-
"release",
17-
"--target",
18-
"wasm32-wasip1",
19-
"-Zbuild-std=core,alloc,panic_abort",
20-
"--",
21-
"-Clink-arg=--import-memory",
22-
"-Clinker-plugin-lto=on",
23-
])
24-
.env("RUSTFLAGS", "-Ctarget-cpu=mvp")
25-
.env("CARGO_TARGET_DIR", &target_dir)
8+
rustc()
9+
.input("foo.rs")
10+
.target("wasm32-wasip1")
11+
.target_cpu("mvp")
12+
.opt_level("z")
13+
.lto("fat")
14+
.linker_plugin_lto("on")
15+
.link_arg("--import-memory")
2616
.run();
27-
28-
let wasm32_program_path = target_dir.join(target()).join("release").join("wasm32_program.wasm");
29-
verify_features(&wasm32_program_path);
17+
verify_features(Path::new("foo.wasm"));
3018
}
3119

3220
fn verify_features(path: &Path) {

tests/run-make/wasm-unexpected-features/wasm32_test/Cargo.toml

Lines changed: 0 additions & 13 deletions
This file was deleted.

tests/run-make/wasm-unexpected-features/wasm32_test/src/lib.rs

Lines changed: 0 additions & 34 deletions
This file was deleted.

0 commit comments

Comments
 (0)