Skip to content

The attribute export_macro is currently unknown to the compiler #40487

@ctz

Description

@ctz

Uh, so I'm being pointed to issue #29642 by current nightly (rustc 1.17.0-nightly (824c9ebbd 2017-03-12)):

error: The attribute `export_macro` is currently unknown to the compiler and may have meaning added to it in the future (see issue #29642)
 --> src/msgs/macros.rs:3:1
  |
3 | #[export_macro]
  | ^^^^^^^^^^^^^^^
  |
  = help: add #![feature(custom_attribute)] to the crate attributes to enable

src/msgs/macros.rs is:

/// A macro which takes an Option<T> and returns None if it
/// is None, otherwise unwraps().
#[export_macro]
macro_rules! try_ret(
    ($e:expr) => (match $e { Some(e) => e, None => return None })
);

This is extremely strange, because export_macro is documented in the book as being needed for macros to work at all:

Only macros defined with the #[macro_export] attribute may be loaded.

So it can't possibly be the case that it's unknown to the compiler.

With that said, the behaviour doesn't match that documentation -- If I remove export_macro the macro is still loadable from other modules.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions