@@ -20,18 +20,17 @@ macro_rules! syscall {
2020 } ;
2121}
2222
23- /// Macro version of `syscall1`.
23+ /// Macro version of `syscall1`
2424#[ macro_export]
2525macro_rules! syscall1 {
2626 ( $nr: ident, $a1: expr) => {
2727 $crate:: syscall1( $crate:: nr:: $nr, $a1 as usize )
2828 } ;
2929}
3030
31- /// Macro for printing to the HOST standard output.
31+ /// Macro for printing to the HOST standard output
3232///
33- /// This is similar to the `print!` macro in the standard library. Both will panic on any failure to
34- /// print.
33+ /// This macro returns a `Result<(), ()>` value
3534#[ macro_export]
3635macro_rules! hprint {
3736 ( $s: expr) => {
@@ -44,8 +43,7 @@ macro_rules! hprint {
4443
4544/// Macro for printing to the HOST standard output, with a newline.
4645///
47- /// This is similar to the `println!` macro in the standard library. Both will panic on any failure to
48- /// print.
46+ /// This macro returns a `Result<(), ()>` value
4947#[ macro_export]
5048macro_rules! hprintln {
5149 ( ) => {
@@ -59,10 +57,9 @@ macro_rules! hprintln {
5957 } ;
6058}
6159
62- /// Macro for printing to the HOST standard error.
60+ /// Macro for printing to the HOST standard error
6361///
64- /// This is similar to the `eprint!` macro in the standard library. Both will panic on any failure
65- /// to print.
62+ /// This macro returns a `Result<(), ()>` value
6663#[ macro_export]
6764macro_rules! heprint {
6865 ( $s: expr) => {
@@ -75,8 +72,7 @@ macro_rules! heprint {
7572
7673/// Macro for printing to the HOST standard error, with a newline.
7774///
78- /// This is similar to the `eprintln!` macro in the standard library. Both will panic on any failure
79- /// to print.
75+ /// This macro returns a `Result<(), ()>` value
8076#[ macro_export]
8177macro_rules! heprintln {
8278 ( ) => {
@@ -90,23 +86,22 @@ macro_rules! heprintln {
9086 } ;
9187}
9288
93- /// Macro that prints and returns the value of a given expression for quick and
94- /// dirty debugging.
95- ///
96- /// Works exactly like `dbg!` in the standard library, replacing `eprintln!`
97- /// with `heprintln!`.
89+ /// Macro that prints and returns the value of a given expression
90+ /// for quick and dirty debugging. Works exactly like `dbg!` in
91+ /// the standard library, replacing `eprintln` with `heprintln`,
92+ /// which it unwraps.
9893#[ macro_export]
9994macro_rules! dbg {
10095 ( ) => {
101- $crate:: heprintln!( "[{}:{}]" , file!( ) , line!( ) ) ;
96+ $crate:: heprintln!( "[{}:{}]" , file!( ) , line!( ) ) . unwrap ( ) ;
10297 } ;
10398 ( $val: expr) => {
10499 // Use of `match` here is intentional because it affects the lifetimes
105100 // of temporaries - https://stackoverflow.com/a/48732525/1063961
106101 match $val {
107102 tmp => {
108103 $crate:: heprintln!( "[{}:{}] {} = {:#?}" ,
109- file!( ) , line!( ) , stringify!( $val) , & tmp) ;
104+ file!( ) , line!( ) , stringify!( $val) , & tmp) . unwrap ( ) ;
110105 tmp
111106 }
112107 }
0 commit comments