diff options
| author | Felix S. Klock II <pnkfelix@pnkfx.org> | 2015-02-15 22:14:03 +0100 |
|---|---|---|
| committer | Felix S. Klock II <pnkfelix@pnkfx.org> | 2015-02-15 22:14:03 +0100 |
| commit | 52bdda778ad595e661d06b16a193b3affe443d41 (patch) | |
| tree | ec62ce5a39ebb1bc3212f6639c3a54f81accb271 /src/libsyntax/ext | |
| parent | 20d8222e6a8a795272eea169c5415e5af28219fb (diff) | |
| download | rust-52bdda778ad595e661d06b16a193b3affe443d41.tar.gz rust-52bdda778ad595e661d06b16a193b3affe443d41.zip | |
Address the `asm!` case of #22234.
Diffstat (limited to 'src/libsyntax/ext')
| -rw-r--r-- | src/libsyntax/ext/asm.rs | 7 | ||||
| -rw-r--r-- | src/libsyntax/ext/expand.rs | 9 |
2 files changed, 15 insertions, 1 deletions
diff --git a/src/libsyntax/ext/asm.rs b/src/libsyntax/ext/asm.rs index 1ceda2e08dd..d8cba139fb5 100644 --- a/src/libsyntax/ext/asm.rs +++ b/src/libsyntax/ext/asm.rs @@ -18,6 +18,7 @@ use codemap; use codemap::Span; use ext::base; use ext::base::*; +use feature_gate; use parse::token::InternedString; use parse::token; use ptr::P; @@ -48,6 +49,12 @@ static OPTIONS: &'static [&'static str] = &["volatile", "alignstack", "intel"]; pub fn expand_asm<'cx>(cx: &'cx mut ExtCtxt, sp: Span, tts: &[ast::TokenTree]) -> Box<base::MacResult+'cx> { + if !cx.ecfg.enable_asm() { + feature_gate::emit_feature_err( + &cx.parse_sess.span_diagnostic, "asm", sp, feature_gate::EXPLAIN_ASM); + return DummyResult::expr(sp); + } + let mut p = cx.new_parser_from_tts(tts); let mut asm = InternedString::new(""); let mut asm_str_style = None; diff --git a/src/libsyntax/ext/expand.rs b/src/libsyntax/ext/expand.rs index 267d732c9e6..e31c1a32749 100644 --- a/src/libsyntax/ext/expand.rs +++ b/src/libsyntax/ext/expand.rs @@ -1425,7 +1425,14 @@ impl<'feat> ExpansionConfig<'feat> { pub fn enable_quotes(&self) -> bool { match self.features { - Some(&Features { quote: true, .. }) => true, + Some(&Features { allow_quote: true, .. }) => true, + _ => false, + } + } + + pub fn enable_asm(&self) -> bool { + match self.features { + Some(&Features { allow_asm: true, .. }) => true, _ => false, } } |
