Rust 1.30.0 is out!

The headline features in 1.30 are:

  • Procedural Macros
  • use and macros
  • Module system improvements
  • Raw Identifiers
  • no_std applications
  • Cargo progress bar

See the blog post and detailed release notes.


I just tried to use a use-statement to import a macro_rules! macro.
That resulted in a compile error complaining about

error[E0432]: unresolved imports `self::log::error`, `self::log::info`, `self::log::warn

for some macros I defined called info, error and warn:

macro_rules! info {
  // ..

// same for error, warn

So does this feature only work with the as-yet unstable macro keyword macros?
If so, what’s the point of stabilizing this now?
If not, what am I missing?

AFAIK macro-use is only possible for foreign crates, not for macros in your crate.


The Edition guide confirms in the macros chapter:

In Rust 2018, you can import specific macros from external crates via use statements, rather than the old #[macro_use] attribute.


Note that you’ll still need #[macro_use] to use macros you’ve defined in your own crate; this feature only works for importing macros from external crates.

edit 2

Release notes do as well confirm (emphasis mine):

You can now import and reexport macros from other crates with the use syntax


I see, that explains the compiler warning behavior I’m seeing.
I always thought that that restriction was only for proc_macros, and the release notes didn’t clarify this point either. I’m glad to see that it’s at least documented :slight_smile: