Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

0.3.0 breaks Rust 2018 style macro imports #10

Closed
yvt opened this issue Nov 15, 2018 · 6 comments
Closed

0.3.0 breaks Rust 2018 style macro imports #10

yvt opened this issue Nov 15, 2018 · 6 comments

Comments

@yvt
Copy link

yvt commented Nov 15, 2018

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 added a commit that referenced this issue Nov 15, 2018
This fixes issue #10, allowing importing the macros in Rust 2018
@nvzqz
Copy link
Owner

nvzqz commented Nov 15, 2018

Should be fixed with commit c2dd597

@nvzqz nvzqz closed this as completed Nov 15, 2018
@nvzqz
Copy link
Owner

nvzqz commented Nov 15, 2018

Just released v0.3.1 with this fix.

@gin-ahirsch
Copy link

Commit d5994b6 broke this again.

@nvzqz
Copy link
Owner

nvzqz commented Oct 17, 2019

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

@gin-ahirsch
Copy link

gin-ahirsch commented Oct 18, 2019

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
Copy link
Owner

nvzqz commented Oct 18, 2019

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).

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants