mirror of
https://github.com/rust-lang/rust.git
synced 2025-06-06 12:18:33 +00:00
Fix test
This commit is contained in:
parent
9a3d98dade
commit
a569cb4022
@ -11,6 +11,22 @@ unsafe extern "C" fn my_puts(s: *const i8) {
|
|||||||
puts(s);
|
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"]
|
#[lang = "termination"]
|
||||||
trait Termination {
|
trait Termination {
|
||||||
fn report(self) -> i32;
|
fn report(self) -> i32;
|
||||||
@ -20,8 +36,9 @@ impl Termination for () {
|
|||||||
fn report(self) -> i32 {
|
fn report(self) -> i32 {
|
||||||
unsafe {
|
unsafe {
|
||||||
NUM = 6 * 7 + 1 + (1u8 == 1u8) as u8; // 44
|
NUM = 6 * 7 + 1 + (1u8 == 1u8) as u8; // 44
|
||||||
*NUM_REF as i32
|
assert_eq!(*NUM_REF as i32, 44);
|
||||||
}
|
}
|
||||||
|
0
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -82,29 +99,12 @@ fn start<T: Termination + 'static>(
|
|||||||
unsafe { puts(*((argv as usize + 2 * intrinsics::size_of::<*const u8>()) as *const *const i8)); }
|
unsafe { puts(*((argv as usize + 2 * intrinsics::size_of::<*const u8>()) as *const *const i8)); }
|
||||||
}
|
}
|
||||||
|
|
||||||
main().report();
|
main().report() as isize
|
||||||
0
|
|
||||||
}
|
}
|
||||||
|
|
||||||
static mut NUM: u8 = 6 * 7;
|
static mut NUM: u8 = 6 * 7;
|
||||||
static NUM_REF: &'static u8 = unsafe { &NUM };
|
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> {
|
struct Unique<T: ?Sized> {
|
||||||
pointer: *const T,
|
pointer: *const T,
|
||||||
_marker: PhantomData<T>,
|
_marker: PhantomData<T>,
|
||||||
|
Loading…
Reference in New Issue
Block a user