diff options
| author | bors <bors@rust-lang.org> | 2016-10-03 01:30:32 -0700 |
|---|---|---|
| committer | GitHub <noreply@github.com> | 2016-10-03 01:30:32 -0700 |
| commit | f3745653e10e366e7e119a12c178a59ab6394007 (patch) | |
| tree | bf0795b7094cd6a48b98760372b711d411f8c3a8 /src/test/run-pass/thinlto | |
| parent | 144af3e97aa30feba3d36a98ac04c0f1b2bc0bea (diff) | |
| parent | 057302bcd9519a54153186abf3ee1e7facf8bdfc (diff) | |
| download | rust-f3745653e10e366e7e119a12c178a59ab6394007.tar.gz rust-f3745653e10e366e7e119a12c178a59ab6394007.zip | |
Auto merge of #36767 - jseyfried:enforce_rfc_1560_shadowing, r=nrc
Enforce the shadowing restrictions from RFC 1560 for today's macros
This PR enforces a weakened version of the shadowing restrictions from RFC 1560. More specifically,
- If a macro expansion contains a `macro_rules!` macro definition that is used outside of the expansion, the defined macro may not shadow an existing macro.
- If a macro expansion contains a `#[macro_use] extern crate` macro import that is used outside of the expansion, the imported macro may not shadow an existing macro.
This is a [breaking-change]. For example,
```rust
macro_rules! m { () => {} }
macro_rules! n { () => {
macro_rules! m { () => {} } //< This shadows an existing macro.
m!(); //< This is inside the expansion that generated `m`'s definition, so it is OK.
} }
n!();
m!(); //< This use of `m` is outside the expansion, so it causes the shadowing to be an error.
```
r? @nrc
Diffstat (limited to 'src/test/run-pass/thinlto')
0 files changed, 0 insertions, 0 deletions
