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

The attribute export_macro is currently unknown to the compiler #40487

Closed
ctz opened this issue Mar 13, 2017 · 2 comments
Closed

The attribute export_macro is currently unknown to the compiler #40487

ctz opened this issue Mar 13, 2017 · 2 comments

Comments

@ctz
Copy link
Contributor

ctz commented Mar 13, 2017

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.

@codyps
Copy link
Contributor

codyps commented Mar 13, 2017

#[macro_export] is not the same as #[export_macro].

@ctz
Copy link
Contributor Author

ctz commented Mar 13, 2017

Oh, how embarrassing. Thanks.

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

2 participants