This repository was archived by the owner on May 28, 2025. It is now read-only.
File tree Expand file tree Collapse file tree 1 file changed +19
-19
lines changed
Expand file tree Collapse file tree 1 file changed +19
-19
lines changed Original file line number Diff line number Diff line change @@ -11,6 +11,22 @@ unsafe extern "C" fn my_puts(s: *const i8) {
1111 puts ( s) ;
1212}
1313
14+ macro_rules! assert {
15+ ( $e: expr) => {
16+ if !$e {
17+ panic( stringify!( ! $e) ) ;
18+ }
19+ } ;
20+ }
21+
22+ macro_rules! assert_eq {
23+ ( $l: expr, $r: expr) => {
24+ if $l != $r {
25+ panic( stringify!( $l != $r) ) ;
26+ }
27+ }
28+ }
29+
1430#[ lang = "termination" ]
1531trait Termination {
1632 fn report ( self ) -> i32 ;
@@ -20,8 +36,9 @@ impl Termination for () {
2036 fn report ( self ) -> i32 {
2137 unsafe {
2238 NUM = 6 * 7 + 1 + ( 1u8 == 1u8 ) as u8 ; // 44
23- * NUM_REF as i32
39+ assert_eq ! ( * NUM_REF as i32 , 44 ) ;
2440 }
41+ 0
2542 }
2643}
2744
@@ -82,29 +99,12 @@ fn start<T: Termination + 'static>(
8299 unsafe { puts ( * ( ( argv as usize + 2 * intrinsics:: size_of :: < * const u8 > ( ) ) as * const * const i8 ) ) ; }
83100 }
84101
85- main ( ) . report ( ) ;
86- 0
102+ main ( ) . report ( ) as isize
87103}
88104
89105static mut NUM : u8 = 6 * 7 ;
90106static NUM_REF : & ' static u8 = unsafe { & NUM } ;
91107
92- macro_rules! assert {
93- ( $e: expr) => {
94- if !$e {
95- panic( stringify!( ! $e) ) ;
96- }
97- } ;
98- }
99-
100- macro_rules! assert_eq {
101- ( $l: expr, $r: expr) => {
102- if $l != $r {
103- panic( stringify!( $l != $r) ) ;
104- }
105- }
106- }
107-
108108struct Unique < T : ?Sized > {
109109 pointer : * const T ,
110110 _marker : PhantomData < T > ,
You can’t perform that action at this time.
0 commit comments