diff options
| author | bors <bors@rust-lang.org> | 2016-05-27 17:46:14 -0700 |
|---|---|---|
| committer | bors <bors@rust-lang.org> | 2016-05-27 17:46:14 -0700 |
| commit | 8b012ed142f03c9082773f5091c58c82d47cae79 (patch) | |
| tree | c475df9a0f4f8c46167dc60916e0b60dffaebe7d /src/liballoc_jemalloc | |
| parent | 7bddce693cec4ae4eb6970ed91289815b316cff3 (diff) | |
| parent | 53ab1378419d48a96e3ae923462f4ba8b921ad53 (diff) | |
| download | rust-8b012ed142f03c9082773f5091c58c82d47cae79.tar.gz rust-8b012ed142f03c9082773f5091c58c82d47cae79.zip | |
Auto merge of #33706 - jseyfried:refactor_cfg, r=nrc
Perform `cfg` attribute processing during macro expansion and fix bugs
This PR refactors `cfg` attribute processing and fixes bugs. More specifically:
- It merges gated feature checking for stmt/expr attributes, `cfg_attr` processing, and `cfg` processing into a single fold.
- This allows feature gated `cfg` variables to be used in `cfg_attr` on unconfigured items. All other feature gated attributes can already be used on unconfigured items.
- It performs `cfg` attribute processing during macro expansion instead of after expansion so that macro-expanded items are configured the same as ordinary items. In particular, to match their non-expanded counterparts,
- macro-expanded unconfigured macro invocations are no longer expanded,
- macro-expanded unconfigured macro definitions are no longer usable, and
- feature gated `cfg` variables on macro-expanded macro definitions/invocations are now errors.
This is a [breaking-change]. For example, the following would break:
```rust
macro_rules! m {
() => {
#[cfg(attr)]
macro_rules! foo { () => {} }
foo!(); // This will be an error
macro_rules! bar { () => { fn f() {} } }
#[cfg(attr)] bar!(); // This will no longer be expanded ...
fn g() { f(); } // ... so that `f` will be unresolved.
#[cfg(target_thread_local)] // This will be a gated feature error
macro_rules! baz { () => {} }
}
}
m!();
```
r? @nrc
Diffstat (limited to 'src/liballoc_jemalloc')
0 files changed, 0 insertions, 0 deletions
