Hi,

I am running the rust compiler from trunk. My macro usage seems to be a

----
macro_rules! my_print(
    ($a:expr, $b:expr) => (
        io::println(fmt!("%d", a));
        io::println(fmt!("%d", b));
    );
)

fn main() {
    let a : int = 1;
    let b : int = 2;
    my_print!(a, b);
}
----

Compiling with "rustc tmp.rs" gives the following suspicious warning

----
tmp.rs:10:8: 10:11 warning: unused variable: `b`
tmp.rs:10     let b : int = 2;
----

and ./tmp prints only "1".  Running "rustc tmp.rs --pretty expanded"
shows below that the second line "io::println(fmt!("%d", b));" was
ignored.

----
fn main() {
    let a: int = 1;
    let b: int = 2;
    io::println({
                    let mut __fmtbuf = ~"";

::unstable::extfmt::rt::conv_int(::unstable::extfmt::rt::Conv{flags:

               ::unstable::extfmt::rt::flag_none,

           width:

               ::unstable::extfmt::rt::CountImplied,

           precision:

               ::unstable::extfmt::rt::CountImplied,

           ty:

               ::unstable::extfmt::rt::TyDefault,},
                                                     a, &mut __fmtbuf);
                    __fmtbuf
                });
}
----

Can someone point me in the right direction here?

Also, can someone provide examples of how exactly log_syntax!() and
trace_macros!(true) work?

Ashish
_______________________________________________
Rust-dev mailing list
[email protected]
https://mail.mozilla.org/listinfo/rust-dev

Reply via email to