diff options
| author | Manish Goregaokar <manishsmail@gmail.com> | 2015-02-17 15:54:25 +0530 |
|---|---|---|
| committer | Manish Goregaokar <manishsmail@gmail.com> | 2015-02-17 17:33:20 +0530 |
| commit | 020e4e4ad981ce0518bd8e3464ac592717c41143 (patch) | |
| tree | feca45da907af4dedc7aa930a8292a5fdf78073a /src/libsyntax/ext/base.rs | |
| parent | 0e892283612ea21ce5aeb3be930296623facab36 (diff) | |
| parent | dc0797c0c99e7079170d0e09f82fc6f66b721932 (diff) | |
| download | rust-020e4e4ad981ce0518bd8e3464ac592717c41143.tar.gz rust-020e4e4ad981ce0518bd8e3464ac592717c41143.zip | |
Rollup merge of #22383 - pnkfelix:pass-features-along-during-expansion, r=huonw
Pass features along during expansion Use the set of passed features to detect uses of feature-gated macros without the corresponding feature enabled. Fix #22234. ---- Also, the framework this add (passing along a reference to the features in the expansion context) is a necessary precursor for landing a properly feature-gated desugaring-based overloaded-`box` and placement-`in` (#22181). ---- This is fixing a bug, but since there might be code out there that is unknowingly taking advantage of that bug, I feel obligated to mark this as a: [breaking-change]
Diffstat (limited to 'src/libsyntax/ext/base.rs')
| -rw-r--r-- | src/libsyntax/ext/base.rs | 9 |
1 files changed, 5 insertions, 4 deletions
diff --git a/src/libsyntax/ext/base.rs b/src/libsyntax/ext/base.rs index 083039995ee..8800ffd1e9b 100644 --- a/src/libsyntax/ext/base.rs +++ b/src/libsyntax/ext/base.rs @@ -439,7 +439,8 @@ impl BlockInfo { /// The base map of methods for expanding syntax extension /// AST nodes into full ASTs -fn initial_syntax_expander_table(ecfg: &expand::ExpansionConfig) -> SyntaxEnv { +fn initial_syntax_expander_table<'feat>(ecfg: &expand::ExpansionConfig<'feat>) + -> SyntaxEnv { // utility function to simplify creating NormalTT syntax extensions fn builtin_normal_expander(f: MacroExpanderFn) -> SyntaxExtension { NormalTT(box f, None) @@ -470,7 +471,7 @@ fn initial_syntax_expander_table(ecfg: &expand::ExpansionConfig) -> SyntaxEnv { syntax_expanders.insert(intern("deriving"), Decorator(box ext::deriving::expand_deprecated_deriving)); - if ecfg.enable_quotes { + if ecfg.enable_quotes() { // Quasi-quoting expanders syntax_expanders.insert(intern("quote_tokens"), builtin_normal_expander( @@ -541,7 +542,7 @@ pub struct ExtCtxt<'a> { pub parse_sess: &'a parse::ParseSess, pub cfg: ast::CrateConfig, pub backtrace: ExpnId, - pub ecfg: expand::ExpansionConfig, + pub ecfg: expand::ExpansionConfig<'a>, pub use_std: bool, pub mod_path: Vec<ast::Ident> , @@ -554,7 +555,7 @@ pub struct ExtCtxt<'a> { impl<'a> ExtCtxt<'a> { pub fn new(parse_sess: &'a parse::ParseSess, cfg: ast::CrateConfig, - ecfg: expand::ExpansionConfig) -> ExtCtxt<'a> { + ecfg: expand::ExpansionConfig<'a>) -> ExtCtxt<'a> { let env = initial_syntax_expander_table(&ecfg); ExtCtxt { parse_sess: parse_sess, |
