Skip to content

Commit

Permalink
Auto merge of #3369 - RalfJung:no-std, r=RalfJung
Browse files Browse the repository at this point in the history
simplify no-std tests

set panic=abort so that we do not need this eh_personality thing
  • Loading branch information
bors committed Mar 9, 2024
2 parents 2af2dc5 + 11a3472 commit 66cf341
Show file tree
Hide file tree
Showing 5 changed files with 9 additions and 17 deletions.
6 changes: 2 additions & 4 deletions tests/fail/alloc/no_global_allocator.rs
Original file line number Diff line number Diff line change
@@ -1,7 +1,8 @@
//@compile-flags: -Cpanic=abort
//@normalize-stderr-test: "OS `.*`" -> "$$OS"
// Make sure we pretend the allocation symbols don't exist when there is no allocator

#![feature(lang_items, start)]
#![feature(start)]
#![no_std]

extern "Rust" {
Expand All @@ -21,6 +22,3 @@ fn start(_: isize, _: *const *const u8) -> isize {
fn panic_handler(_: &core::panic::PanicInfo) -> ! {
loop {}
}

#[lang = "eh_personality"]
fn eh_personality() {}
6 changes: 2 additions & 4 deletions tests/fail/panic/no_std.rs
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
#![feature(lang_items, start, core_intrinsics)]
#![feature(start, core_intrinsics)]
#![no_std]
//@compile-flags: -Cpanic=abort
// windows tls dtors go through libstd right now, thus this test
// cannot pass. When windows tls dtors go through the special magic
// windows linker section, we can run this test on windows again.
Expand Down Expand Up @@ -36,6 +37,3 @@ fn panic_handler(panic_info: &core::panic::PanicInfo) -> ! {
writeln!(HostErr, "{panic_info}").ok();
core::intrinsics::abort(); //~ ERROR: the program aborted execution
}

#[lang = "eh_personality"]
fn eh_personality() {}
6 changes: 2 additions & 4 deletions tests/pass/miri-alloc.rs
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
#![feature(lang_items, start)]
#![feature(start)]
#![no_std]
//@compile-flags: -Cpanic=abort
// windows tls dtors go through libstd right now, thus this test
// cannot pass. When windows tls dtors go through the special magic
// windows linker section, we can run this test on windows again.
Expand All @@ -24,6 +25,3 @@ fn start(_: isize, _: *const *const u8) -> isize {
fn panic_handler(_: &core::panic::PanicInfo) -> ! {
loop {}
}

#[lang = "eh_personality"]
fn eh_personality() {}
6 changes: 2 additions & 4 deletions tests/pass/no_std.rs
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
#![feature(lang_items, start)]
//@compile-flags: -Cpanic=abort
#![feature(start)]
#![no_std]

// Plumbing to let us use `writeln!` to host stdout:
Expand Down Expand Up @@ -32,6 +33,3 @@ fn start(_: isize, _: *const *const u8) -> isize {
fn panic_handler(_: &core::panic::PanicInfo) -> ! {
loop {}
}

#[lang = "eh_personality"]
fn eh_personality() {}
2 changes: 1 addition & 1 deletion tests/pass/overloaded-calls-simple.rs
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
#![feature(lang_items, unboxed_closures, fn_traits)]
#![feature(unboxed_closures, fn_traits)]

struct S3 {
x: i32,
Expand Down

0 comments on commit 66cf341

Please sign in to comment.