Skip to content

Commit

Permalink
Fix test
Browse files Browse the repository at this point in the history
  • Loading branch information
bjorn3 committed Apr 18, 2021
1 parent 9a3d98d commit a569cb4
Showing 1 changed file with 19 additions and 19 deletions.
38 changes: 19 additions & 19 deletions example/mini_core_hello_world.rs
Expand Up @@ -11,6 +11,22 @@ unsafe extern "C" fn my_puts(s: *const i8) {
puts(s);
}

macro_rules! assert {
($e:expr) => {
if !$e {
panic(stringify!(! $e));
}
};
}

macro_rules! assert_eq {
($l:expr, $r: expr) => {
if $l != $r {
panic(stringify!($l != $r));
}
}
}

#[lang = "termination"]
trait Termination {
fn report(self) -> i32;
Expand All @@ -20,8 +36,9 @@ impl Termination for () {
fn report(self) -> i32 {
unsafe {
NUM = 6 * 7 + 1 + (1u8 == 1u8) as u8; // 44
*NUM_REF as i32
assert_eq!(*NUM_REF as i32, 44);
}
0
}
}

Expand Down Expand Up @@ -82,29 +99,12 @@ fn start<T: Termination + 'static>(
unsafe { puts(*((argv as usize + 2 * intrinsics::size_of::<*const u8>()) as *const *const i8)); }
}

main().report();
0
main().report() as isize
}

static mut NUM: u8 = 6 * 7;
static NUM_REF: &'static u8 = unsafe { &NUM };

macro_rules! assert {
($e:expr) => {
if !$e {
panic(stringify!(! $e));
}
};
}

macro_rules! assert_eq {
($l:expr, $r: expr) => {
if $l != $r {
panic(stringify!($l != $r));
}
}
}

struct Unique<T: ?Sized> {
pointer: *const T,
_marker: PhantomData<T>,
Expand Down

0 comments on commit a569cb4

Please sign in to comment.