]> git.lizzy.rs Git - rust.git/commit
Auto merge of #34032 - jseyfried:load_macros_in_expansion, r=nrc
authorbors <bors@rust-lang.org>
Thu, 9 Jun 2016 05:45:35 +0000 (22:45 -0700)
committerbors <bors@rust-lang.org>
Thu, 9 Jun 2016 05:45:35 +0000 (22:45 -0700)
commitdc77c5ebe80d8e8fe08b9ba05859c04f4dbb99cf
treeaf17b87c2f0a96ae5d184d750ddcb96e88fa095d
parentbb4b3fb7f97924919f072ec9a360bdf943218dbf
parentdbf0326ddc041e772b5ab07b19e893e8955bf934
Auto merge of #34032 - jseyfried:load_macros_in_expansion, r=nrc

Support `#[macro_use]` on macro-expanded crates

This PR loads macros from `#[macro_use]` crates during expansion so that
 - macro-expanded `#[macro_use]` crates work (fixes #33936, fixes #28071), and
 - macros imported from crates have the same scope as macros imported from modules.

This is a [breaking-change]. For example, this will break:
```rust
macro_rules! m {
    () => { #[macro_use(foo)] extern crate core; } //~ ERROR imported macro not found
}
m!();
```
Also, this will break:
```rust
macro_rules! try { () => {} }
// #[macro_use] mod bar { macro_rules! try { ... } } //< ... just like this would ...
fn main() { try!(); } //< ... making this an error
```

r? @nrc