nvzqz/static-assertions

0.3.0 breaks Rust 2018 style macro imports

yvt opened this issue · 6 comments

yvt commented

The following code no longer compiles as of 0.3.0:

use static_assertions::const_assert;

fn main() {
    const_assert!(true);
}
error: cannot find macro `_const_assert!` in this scope
 --> src/main.rs:4:5
  |
4 |     const_assert!(true);
  |     ^^^^^^^^^^^^^^^^^^^^ help: you could try the macro: `const_assert`
  |
  = note: this error originates in a macro outside of the current crate (in Nightly builds, run with -Z external-macro-backtrace for more info)

Related: rust-lang-nursery/lazy-static.rs#107

nvzqz commented

Should be fixed with commit c2dd597

nvzqz commented

Just released v0.3.1 with this fix.

Commit d5994b6 broke this again.

nvzqz commented

@gin-ahirsch OP's example works for me with 1.0. What error are you getting?

Ah indeed, const_assert! does work. assert_qe_size_val! does not though: error: cannot find macro `assert_eq_size_ptr!` in this scope.

nvzqz commented

Ah, so my doc tests didn't catch that because I #[macro_use]-ed the crate, which imports all macros. I'll update my tests to use macros to catch things like this going forward. I actually caught this same error when writing assert_impl_one! (added in #23).