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

Work out the actual policy for macros across editions wrt dependencies updating #50172

Open
Manishearth opened this issue Apr 23, 2018 · 5 comments
Labels
C-enhancement Category: An issue proposing an enhancement or a PR with one. T-lang Relevant to the language team, which will review and decide on the PR/issue. WG-epoch Working group: Epoch (2018) management

Comments

@Manishearth
Copy link
Member

I don’t think we’ve adequately worked out what we want for macros with editions.

Are we okay with a Rust 2015 crate that exposes a macro updating to Rust 2018 (including new idioms) with a minor bump? I.e. should our edition hygiene account for this? Or are macro authors instructed to do major bumps when they

Taking a hypothetical: if dyn were something we only exposed on Rust 2018, and a macro crate upgraded to the new edition, should we do the heavy lifting of ensuring that crates on Rust 2015 can use macros from crates on Rust 2018 that use 2018-only features? Or do we require the crate author to do a major version bump?

Similarly, what level of trouble are we okay with for crates attempting to upgrade to the 2018 edition that use macros from 2015 crates?

cc @rust-lang/lang

@Manishearth Manishearth added I-nominated T-lang Relevant to the language team, which will review and decide on the PR/issue. WG-epoch Working group: Epoch (2018) management labels Apr 23, 2018
@nikomatsakis
Copy link
Contributor

Moved to the lang team project management dashboard to track status.

@nikomatsakis
Copy link
Contributor

I think the scenario in question is:

  • Crate A is in Rust 2018 Edition
    • It exports a macro M using a Rust 2018-only feature (e.g., catch)
  • Crate B is in Rust 2015 Edition
    • It uses the macro M

Right? If so, I definitely think we should make this work if we can (and hence it would not require a semver major bump).

@Manishearth
Copy link
Member Author

Sounds good. Seems tricky to implement.

@nikomatsakis
Copy link
Contributor

I feel like if we were to serialize macros as token trees, and we reflect whether a given identifier is a token or not as part of that info, it would "just work". I must be missing something though.

@upsuper
Copy link
Contributor

upsuper commented May 26, 2018

If a procedural macro drops span information, this may still be a problem. But it's probably not a big concern given the current common practice of writing procedural macro?

Parsing in a procedural macro can also fail due to syntax difference, but its probably not worse than introducing new syntax in current manner. The tricky thing is that it may become less clear whether a change in the parsing part is breaking or non-breaking change. (Do we consider requiring a newer version of compiler a breaking change?) Some authors of procedural macro may eventually find supporting syntax of old edition an extra burden and drop such support, which may lead to questioning Rust's interoperability promise.

@XAMPPRocky XAMPPRocky added the C-enhancement Category: An issue proposing an enhancement or a PR with one. label Sep 25, 2018
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
C-enhancement Category: An issue proposing an enhancement or a PR with one. T-lang Relevant to the language team, which will review and decide on the PR/issue. WG-epoch Working group: Epoch (2018) management
Projects
None yet
Development

No branches or pull requests

4 participants