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

macros: clean up scopes of expanded #[macro_use] imports #37084

Merged
merged 14 commits into from
Oct 13, 2016

Conversation

jseyfried
Copy link
Contributor

@jseyfried jseyfried commented Oct 11, 2016

This PR changes the scope of macro-expanded #[macro_use] imports to match that of unexpanded #[macro_use] imports. For example, this would be allowed:

example!();
macro_rules! m { () => { #[macro_use(example)] extern crate example_crate; } }
m!();

This PR also enforces the full shadowing restrictions from RFC 1560 on #[macro_use] imports (currently, we only enforce the weakened restrictions from #36767).

This is a [breaking-change], but I believe it is highly unlikely to cause breakage in practice.
r? @nrc

@nrc
Copy link
Member

nrc commented Oct 11, 2016

@EddyD, @brson, @nikomatsakis could this get a Crater run please?

@jseyfried
Copy link
Contributor Author

*@eddyb

@eddyb
Copy link
Member

eddyb commented Oct 11, 2016

Starting crater run now.

@nrc
Copy link
Member

nrc commented Oct 12, 2016

Thanks @eddyb!

@nrc
Copy link
Member

nrc commented Oct 12, 2016

@bors: r+

@bors
Copy link
Contributor

bors commented Oct 12, 2016

📌 Commit 829bd8c has been approved by nrc

@nrc
Copy link
Member

nrc commented Oct 12, 2016

ah crap

@bors: r-

@nrc
Copy link
Member

nrc commented Oct 12, 2016

r=me if the Crater run comes back clean

@eddyb
Copy link
Member

eddyb commented Oct 12, 2016

The crater report only has crater download failures and such (cc @brson).

@bors r=nrc

@bors
Copy link
Contributor

bors commented Oct 12, 2016

📌 Commit 829bd8c has been approved by nrc

alexcrichton added a commit to alexcrichton/rust that referenced this pull request Oct 12, 2016
…e_scopes, r=nrc

macros: clean up scopes of expanded `#[macro_use]` imports

This PR changes the scope of macro-expanded `#[macro_use]` imports to match that of unexpanded `#[macro_use]` imports. For example, this would be allowed:
```rust
example!();
macro_rules! m { () => { #[macro_use(example)] extern crate example_crate; } }
m!();
```

This PR also enforces the full shadowing restrictions from RFC 1560 on `#[macro_use]` imports (currently, we only enforce the weakened restrictions from rust-lang#36767).

This is a [breaking-change], but I believe it is highly unlikely to cause breakage in practice.
r? @nrc
bors added a commit that referenced this pull request Oct 12, 2016
@bors bors merged commit 829bd8c into rust-lang:master Oct 13, 2016
@jseyfried jseyfried deleted the cleanup_expanded_macro_use_scopes branch October 16, 2016 09:24
bors added a commit that referenced this pull request Nov 7, 2016
macros: improve shadowing checks

This PR improves macro-expanded shadowing checks to work with out-of-(pre)order expansion.

Out-of-order expansion became possible in #37084, so this technically a [breaking-change] for nightly.
The regression test from this PR is an example of code that would break.

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.

4 participants