rust/src/libsyntax
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
..
diagnostics replace fileline_{help,note} with {help,note} 2016-05-02 11:49:23 -04:00
errors Rollup merge of #33730 - jseyfried:fix_macro_backtrace_diagnostics, r=nikomatsakis 2016-05-19 21:21:08 +05:30
ext Auto merge of #33706 - jseyfried:refactor_cfg, r=nrc 2016-05-27 17:46:14 -07:00
parse Auto merge of #33900 - GuillaumeGomez:rollup, r=GuillaumeGomez 2016-05-27 03:56:19 -07:00
print Rollup merge of #33644 - petrochenkov:selfast, r=nrc 2016-05-27 09:57:11 +05:30
util Remove ExplicitSelf from AST 2016-05-25 21:55:04 +03:00
abi.rs [breaking-change] don't glob import/export syntax::abi enum variants 2016-02-11 12:34:48 +01:00
ast.rs Auto merge of #33706 - jseyfried:refactor_cfg, r=nrc 2016-05-27 17:46:14 -07:00
attr.rs Add and use HasAttrs trait 2016-05-26 23:23:01 +00:00
Cargo.toml rustbuild: Fix dist for non-host targets 2016-04-01 10:18:36 -07:00
codemap.rs Auto merge of #33706 - jseyfried:refactor_cfg, r=nrc 2016-05-27 17:46:14 -07:00
config.rs Comment methods in CfgFolder 2016-05-27 23:57:02 +00:00
entry.rs [breaking-change] don't glob export ast::Item_ variants 2016-02-11 12:34:48 +01:00
feature_gate.rs Rollup merge of #33639 - petrochenkov:dotdot, r=nmatsakis 2016-05-27 09:57:00 +05:30
fold.rs Rollup merge of #33644 - petrochenkov:selfast, r=nrc 2016-05-27 09:57:11 +05:30
lib.rs Nit: use Range::contains 2016-05-02 11:49:25 -04:00
ptr.rs Remove some old code from libsyntax 2016-04-24 21:04:09 +03:00
show_span.rs use structured errors 2015-12-30 14:27:59 +13:00
std_inject.rs syntax: Merge keywords and remaining special idents in one list 2016-04-24 20:59:44 +03:00
str.rs syntax: Copy unstable str::char_at into libsyntax 2015-04-21 10:23:53 -07:00
test.rs Process cfg_attr attributes on non-optional expressions 2016-05-27 00:01:04 +00:00
visit.rs Rollup merge of #33644 - petrochenkov:selfast, r=nrc 2016-05-27 09:57:11 +05:30