rust/src/libsyntax/ext
bors 8b012ed142 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
2016-05-27 17:46:14 -07:00
..
tt Avoid iterating two times over the list of LHSes. 2016-05-24 11:21:37 +02:00
base.rs replace fileline_{help,note} with {help,note} 2016-05-02 11:49:23 -04:00
build.rs Implement .. in tuple (struct) patterns 2016-05-26 11:11:58 +03:00
expand.rs Auto merge of #33706 - jseyfried:refactor_cfg, r=nrc 2016-05-27 17:46:14 -07:00
mtwt.rs Add comment for the use of Ident in hash map in mtwt 2015-10-06 01:47:35 +03:00
quote.rs syntax: Check paths in visibilities for type parameters 2016-04-24 20:59:44 +03:00
source_util.rs [breaking-change] don't pub export ast::Lit_ variants 2016-02-11 12:34:48 +01:00