Skip to content

macros cannot be marked with stability attributes #17316

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

Closed
thestinger opened this issue Sep 16, 2014 · 6 comments
Closed

macros cannot be marked with stability attributes #17316

thestinger opened this issue Sep 16, 2014 · 6 comments
Labels
P-medium Medium priority

Comments

@thestinger
Copy link
Contributor

No description provided.

@aturon
Copy link
Member

aturon commented Sep 17, 2014

@vberger are you interested in looking into this? I'd be glad to provide help, but I probably won't have time to look into it myself for a little while.

@elinorbgr
Copy link
Contributor

@aturon It looks indeed interesting. But to be honest I have no idea where to start...

@pnkfelix
Copy link
Member

(The issue is that right now we cannot add macros to the prelude and mark them as experimental; once a macro is added to the prelude, right now if we released like that, we would be stuck supporting it forever.)

However, @alexcrichton says there are not many macros that we are planning to add to the prelude anyway, so the need for this is not very high.

Assigning P-high, not 1.0 milestone.

@pnkfelix pnkfelix added P-medium Medium priority and removed I-nominated labels Sep 18, 2014
@elinorbgr
Copy link
Contributor

I started digging back into this. I see two steps:

  • Exporting the stability attributes as well when doing #[macro_export]
  • Handling the attributes during compilation

The first part is pretty easy (I managed doing it by simply printing the appropriate #[stability="message"] just before the macro code in crate metadata, as the information is already available to the function doing the writing).

The second point is the real issue. When macro_rules! is processed, in syntax::ext::expand::expand_item_mac(...) the information about stability markers is present and thus we "just" need to store it somewhere (nb: this is also the case for extern macros with my first modification, so there is no need of handling them differently).

But macro expansion is processed in phase 2 of compilation, while the building of the stability index used by the lint is made in phase 3.

So we must either do the stability checking at the same time as macro expansion, or find a way to make macro stability information available to the stability index.

What do you think ?

@steveklabnik
Copy link
Member

Traige: as @pnkfelix mentions, this isn't a big deal for the standard library. Plus, stability attributes aren't currently used by any non-stdlib crates, making this a further non-issue. However, a future ecosystem stability system would have to take this into account.

@steveklabnik
Copy link
Member

Given that this would be a concern of an RFC for the external stability system, I'm giving it a close.

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

No branches or pull requests

5 participants