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

Support useing externally defined macros behind #![feature(use_extern_macros)] #37732

Merged
merged 8 commits into from
Nov 17, 2016

Conversation

jseyfried
Copy link
Contributor

@jseyfried jseyfried commented Nov 12, 2016

With #![feature(use_extern_macros)],

  • A name collision between macros from different upstream crates is much less of an issue since we can use the macros in different submodules or rename with as.
  • We can reexport macros with pub use, so #![feature(macro_reexport)] is no longer needed.
  • These reexports are allowed in any module, so crates can expose a macro-modular interface.

If a macro invocation can resolve to both a use import and a macro_rules! or #[macro_use], it is currently an ambiguity error.

r? @nrc

@jseyfried
Copy link
Contributor Author

cc #35896, #35900

@jseyfried jseyfried force-pushed the use_extern_macros branch 4 times, most recently from 8e1dcf6 to cc550af Compare November 13, 2016 11:41
Copy link
Member

@nrc nrc left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

r = me with the style nits addressed

self.used_crates.insert(def.def_id().krate);
fn legacy_import_macro(
&mut self, name: Name, binding: &'b NameBinding<'b>, span: Span, allow_shadowing: bool,
) {
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

formatting nit: prefer one arg per line

parent: Module<'b>,
vis: ty::Visibility) {
fn build_reduced_graph_for_variant(
&mut self, variant: &Variant, parent: Module<'b>, vis: ty::Visibility, expansion: Mark,
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

style nit - sig - here and below

@bors
Copy link
Contributor

bors commented Nov 16, 2016

☔ The latest upstream changes (presumably #37545) made this pull request unmergeable. Please resolve the merge conflicts.

@jseyfried
Copy link
Contributor Author

@bors r=nrc

@bors
Copy link
Contributor

bors commented Nov 17, 2016

📌 Commit 6cb33a0 has been approved by nrc

@bors
Copy link
Contributor

bors commented Nov 17, 2016

⌛ Testing commit 6cb33a0 with merge c57b826...

bors added a commit that referenced this pull request Nov 17, 2016
Support `use`ing externally defined macros behind `#![feature(use_extern_macros)]`

With `#![feature(use_extern_macros)]`,
 - A name collision between macros from different upstream crates is much less of an issue since we can `use` the macros in different submodules or rename with `as`.
 - We can reexport macros with `pub use`, so `#![feature(macro_reexport)]` is no longer needed.
 - These reexports are allowed in any module, so crates can expose a macro-modular interface.

If a macro invocation can resolve to both a `use` import and a `macro_rules!` or `#[macro_use]`, it is an ambiguity error.

r? @nrc
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

Successfully merging this pull request may close these issues.

3 participants