Skip to content

Commit ec287a7

Browse files
committed
Fix rebase fallout
1 parent b21c337 commit ec287a7

File tree

4 files changed

+107
-42
lines changed

4 files changed

+107
-42
lines changed

build_system/tests.rs

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -57,7 +57,7 @@ impl TestCase {
5757
}
5858

5959
const NO_SYSROOT_SUITE: &[TestCase] = &[
60-
TestCase::build_lib("build.mini_core", "example/mini_core.rs", "lib,dylib"),
60+
TestCase::build_lib("build.mini_core", "example/mini_core.rs", "lib"),
6161
TestCase::build_lib("build.example", "example/example.rs", "lib"),
6262
TestCase::jit_bin("jit.mini_core_hello_world", "example/mini_core_hello_world.rs", "abc bcd"),
6363
TestCase::build_bin_and_run(
@@ -378,7 +378,8 @@ impl<'a> TestRunner<'a> {
378378
TestCaseCmd::BuildBinAndRun { source, args } => {
379379
self.run_rustc([source]);
380380
self.run_out_command(
381-
source.split('/').last().unwrap().split('.').next().unwrap(),
381+
&(source.split('/').last().unwrap().split('.').next().unwrap().to_owned()
382+
+ ".wasm"),
382383
args,
383384
);
384385
}

build_system/utils.rs

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -51,6 +51,9 @@ impl Compiler {
5151
"/usr/riscv64-linux-gnu".to_owned(),
5252
];
5353
}
54+
"wasm32-wasip1" => {
55+
self.runner = vec!["wasmtime".to_owned(), "run".to_owned()];
56+
}
5457
"x86_64-pc-windows-gnu" => {
5558
// We are cross-compiling for Windows. Run tests in wine.
5659
self.runner = vec!["wine".to_owned()];

minimal_wasm_module.rs

Lines changed: 94 additions & 39 deletions
Original file line numberDiff line numberDiff line change
@@ -26,23 +26,23 @@ pub trait Tuple {}
2626
#[lang = "copy"]
2727
pub unsafe trait Copy {}
2828

29-
unsafe impl Copy for bool {}
30-
unsafe impl Copy for u8 {}
31-
unsafe impl Copy for u16 {}
32-
unsafe impl Copy for u32 {}
33-
unsafe impl Copy for u64 {}
34-
unsafe impl Copy for u128 {}
35-
unsafe impl Copy for usize {}
36-
unsafe impl Copy for i8 {}
37-
unsafe impl Copy for i16 {}
38-
unsafe impl Copy for i32 {}
39-
unsafe impl Copy for isize {}
40-
unsafe impl Copy for f32 {}
41-
unsafe impl Copy for f64 {}
42-
unsafe impl Copy for char {}
43-
unsafe impl<'a, T: ?Sized> Copy for &'a T {}
44-
unsafe impl<T: ?Sized> Copy for *const T {}
45-
unsafe impl<T: ?Sized> Copy for *mut T {}
29+
impl Copy for bool {}
30+
impl Copy for u8 {}
31+
impl Copy for u16 {}
32+
impl Copy for u32 {}
33+
impl Copy for u64 {}
34+
impl Copy for u128 {}
35+
impl Copy for usize {}
36+
impl Copy for i8 {}
37+
impl Copy for i16 {}
38+
impl Copy for i32 {}
39+
impl Copy for isize {}
40+
impl Copy for f32 {}
41+
impl Copy for f64 {}
42+
impl Copy for char {}
43+
impl<'a, T: ?Sized> Copy for &'a T {}
44+
impl<T: ?Sized> Copy for *const T {}
45+
impl<T: ?Sized> Copy for *mut T {}
4646

4747
#[lang = "sync"]
4848
pub unsafe trait Sync {}
@@ -67,6 +67,12 @@ unsafe auto trait Freeze {}
6767
#[lang = "structural_peq"]
6868
pub trait StructuralPartialEq {}
6969

70+
#[lang = "legacy_receiver"]
71+
pub trait LegacyReceiver {}
72+
73+
impl<T: ?Sized> LegacyReceiver for &T {}
74+
impl<T: ?Sized> LegacyReceiver for &mut T {}
75+
7076
#[lang = "not"]
7177
pub trait Not {
7278
type Output;
@@ -166,27 +172,76 @@ pub trait Drop {
166172
}
167173

168174
pub mod intrinsics {
169-
extern "rust-intrinsic" {
170-
#[rustc_safe_intrinsic]
171-
pub fn abort() -> !;
172-
#[rustc_safe_intrinsic]
173-
pub fn size_of<T>() -> usize;
174-
pub fn size_of_val<T: ?::Sized>(val: *const T) -> usize;
175-
#[rustc_safe_intrinsic]
176-
pub fn min_align_of<T>() -> usize;
177-
pub fn min_align_of_val<T: ?::Sized>(val: *const T) -> usize;
178-
pub fn copy<T>(src: *const T, dst: *mut T, count: usize);
179-
pub fn transmute<T, U>(e: T) -> U;
180-
pub fn ctlz_nonzero<T>(x: T) -> u32;
181-
#[rustc_safe_intrinsic]
182-
pub fn needs_drop<T: ?::Sized>() -> bool;
183-
#[rustc_safe_intrinsic]
184-
pub fn bitreverse<T>(x: T) -> T;
185-
#[rustc_safe_intrinsic]
186-
pub fn bswap<T>(x: T) -> T;
187-
pub fn write_bytes<T>(dst: *mut T, val: u8, count: usize);
188-
#[rustc_safe_intrinsic]
189-
pub fn caller_location() -> &'static crate::Location<'static>;
175+
#[rustc_intrinsic]
176+
#[rustc_intrinsic_must_be_overridden]
177+
pub fn abort() -> ! {
178+
loop {}
179+
}
180+
#[rustc_intrinsic]
181+
#[rustc_intrinsic_must_be_overridden]
182+
pub fn size_of<T>() -> usize {
183+
loop {}
184+
}
185+
#[rustc_intrinsic]
186+
#[rustc_intrinsic_must_be_overridden]
187+
pub unsafe fn size_of_val<T: ?::Sized>(_val: *const T) -> usize {
188+
loop {}
189+
}
190+
#[rustc_intrinsic]
191+
#[rustc_intrinsic_must_be_overridden]
192+
pub fn min_align_of<T>() -> usize {
193+
loop {}
194+
}
195+
#[rustc_intrinsic]
196+
#[rustc_intrinsic_must_be_overridden]
197+
pub unsafe fn min_align_of_val<T: ?::Sized>(_val: *const T) -> usize {
198+
loop {}
199+
}
200+
#[rustc_intrinsic]
201+
#[rustc_intrinsic_must_be_overridden]
202+
pub unsafe fn copy<T>(_src: *const T, _dst: *mut T, _count: usize) {
203+
loop {}
204+
}
205+
#[rustc_intrinsic]
206+
#[rustc_intrinsic_must_be_overridden]
207+
pub unsafe fn transmute<T, U>(_e: T) -> U {
208+
loop {}
209+
}
210+
#[rustc_intrinsic]
211+
#[rustc_intrinsic_must_be_overridden]
212+
pub unsafe fn ctlz_nonzero<T>(_x: T) -> u32 {
213+
loop {}
214+
}
215+
#[rustc_intrinsic]
216+
#[rustc_intrinsic_must_be_overridden]
217+
pub fn needs_drop<T: ?::Sized>() -> bool {
218+
loop {}
219+
}
220+
#[rustc_intrinsic]
221+
#[rustc_intrinsic_must_be_overridden]
222+
pub fn bitreverse<T>(_x: T) -> T {
223+
loop {}
224+
}
225+
#[rustc_intrinsic]
226+
#[rustc_intrinsic_must_be_overridden]
227+
pub fn bswap<T>(_x: T) -> T {
228+
loop {}
229+
}
230+
#[rustc_intrinsic]
231+
#[rustc_intrinsic_must_be_overridden]
232+
pub unsafe fn write_bytes<T>(_dst: *mut T, _val: u8, _count: usize) {
233+
loop {}
234+
}
235+
#[rustc_intrinsic]
236+
#[rustc_intrinsic_must_be_overridden]
237+
pub unsafe fn unreachable() -> ! {
238+
loop {}
239+
}
240+
241+
#[rustc_intrinsic]
242+
#[rustc_intrinsic_must_be_overridden]
243+
pub fn caller_location() -> &'static crate::Location<'static> {
244+
loop {}
190245
}
191246
}
192247

@@ -349,7 +404,7 @@ fn _start() {
349404

350405
#[allow(arithmetic_overflow)]
351406
{
352-
0xffffffffu32 + 1u32;
407+
//0xffffffffu32 + 1u32;
353408
}
354409

355410
if argc != 2 {

src/lib.rs

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -259,7 +259,13 @@ impl CodegenBackend for CraneliftCodegenBackend {
259259
fn link(&self, sess: &Session, codegen_results: CodegenResults, outputs: &OutputFilenames) {
260260
use rustc_codegen_ssa::back::link::link_binary;
261261

262-
if sess.target.arch == "wasm32" {
262+
if sess.target.arch == "wasm32"
263+
&& codegen_results
264+
.crate_info
265+
.crate_types
266+
.iter()
267+
.any(|&crate_type| crate_type == CrateType::Executable)
268+
{
263269
let output = out_filename(
264270
sess,
265271
CrateType::Executable,

0 commit comments

Comments
 (0)