rust-lang / log

Logging implementation for Rust
https://docs.rs/log
Apache License 2.0
2.2k stars 254 forks source link

`unexpected end of macro invocation` with log 0.4.4 #291

Closed dbrgn closed 6 years ago

dbrgn commented 6 years ago

After upgrading to log 0.4.4 the debug! calls in an example script fail:

   Compiling saltyrtc-client v0.5.0 (file:///root/project)
error: unexpected end of macro invocation
   --> examples/chat/main.rs:443:33
    |
443 |             Ok(_) => future::ok(debug!("† Send loop future done")),
    |                                 ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
    |
    = note: this error originates in a macro outside of the current crate (in Nightly builds, run with -Z external-macro-backtrace for more info)

error: unexpected end of macro invocation
   --> examples/chat/main.rs:481:33
    |
481 |             Ok(_) => future::ok(debug!("† Receive loop future done")),
    |                                 ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
    |
    = note: this error originates in a macro outside of the current crate (in Nightly builds, run with -Z external-macro-backtrace for more info)

error: unexpected end of macro invocation
   --> examples/chat/main.rs:506:33
    |
506 |             Ok(_) => future::ok(debug!("† Event loop future done")),
    |                                 ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
    |
    = note: this error originates in a macro outside of the current crate (in Nightly builds, run with -Z external-macro-backtrace for more info)

error: unexpected end of macro invocation
   --> examples/chat/main.rs:532:5
    |
532 |     info!("Goodbye!");
    |     ^^^^^^^^^^^^^^^^^^
    |
    = note: this error originates in a macro outside of the current crate (in Nightly builds, run with -Z external-macro-backtrace for more info)

You can find the error in CI here: https://circleci.com/gh/saltyrtc/saltyrtc-client-rs/300

When downgrading to log 0.4.3 it works again:

$ cargo update -p log:0.4.4 --precise 0.4.3

To reproduce:

$ git clone https://github.com/saltyrtc/saltyrtc-client-rs
$ cd saltyrtc-client-rs
$ cargo build --examples # This should fail to compile
$ cargo update -p log:0.4.4 --precise 0.4.3
$ cargo build --examples # Now it will work
dtolnay commented 6 years ago

Thanks! Fixed in #292, released in 0.4.5. The problem was this macro in your example code conflicting with one of our private internal helper macros. Problems like this will be fixed by the macro improvements in Rust 2018.

dbrgn commented 6 years ago

Thanks for the quick reaction and the fix, @dtolnay!