AltF02 / x11-rs

Rust bindings for X11 libraries
https://docs.rs/x11
MIT License
204 stars 66 forks source link

error: macro expansion ignores token `assert` and any following #50

Closed letharion closed 7 years ago

letharion commented 7 years ago

I'm trying to build a simple piston project, and piston pulls x11-rs in.

When cargo gets to Compiling x11-dl v2.9.0

it fails with:

/home/letharion/.cargo/registry/src/github.com-1ecc6299db9ec823/x11-dl-2.9.0/src/xlib.rs:1849:5: 1849:11 error: macro expansion ignores token `assert` and any following
/home/letharion/.cargo/registry/src/github.com-1ecc6299db9ec823/x11-dl-2.9.0/src/xlib.rs:1849     assert!(::std::mem::size_of::<XkbEvent>() >= ::std::mem::size_of::<$ty>());
                                                                                                  ^~~~~~
/home/letharion/.cargo/registry/src/github.com-1ecc6299db9ec823/x11-dl-2.9.0/src/xlib.rs:1855:3: 1868:4 note: caused by the macro expansion here; the usage of `test_xkb_event_size!` is likely invalid in expression context
/home/letharion/.cargo/registry/src/github.com-1ecc6299db9ec823/x11-dl-2.9.0/src/xlib.rs:1855   test_xkb_event_size! {
/home/letharion/.cargo/registry/src/github.com-1ecc6299db9ec823/x11-dl-2.9.0/src/xlib.rs:1856     XkbAnyEvent,
/home/letharion/.cargo/registry/src/github.com-1ecc6299db9ec823/x11-dl-2.9.0/src/xlib.rs:1857     XkbNewKeyboardNotifyEvent,
/home/letharion/.cargo/registry/src/github.com-1ecc6299db9ec823/x11-dl-2.9.0/src/xlib.rs:1858     XkbMapNotifyEvent,
/home/letharion/.cargo/registry/src/github.com-1ecc6299db9ec823/x11-dl-2.9.0/src/xlib.rs:1859     XkbStateNotifyEvent,
/home/letharion/.cargo/registry/src/github.com-1ecc6299db9ec823/x11-dl-2.9.0/src/xlib.rs:1860     XkbControlsNotifyEvent,

I'm a little to new to rust to work out what the issue is unfortunately. Since the code is marked as a test though, I naively tried just dropping the roughly 20 lines involved, and my project builds. (For better or worse)

ghost commented 7 years ago

I can't seem to figure out what would cause this. Are you compiling with the current stable version of rust?

letharion commented 7 years ago

I could have sworn I was, but then I actually checked. Turns out I had an older parallel installation that was taking precedence in my PATH. Fixed that now so I'm actually using 1.12 and everything compiles fine. Sorry for the noise. :)