Add a feature flag for ASM
This commit is contained in:
parent
424c171da5
commit
c5346fea38
|
@ -34,6 +34,7 @@ static KNOWN_FEATURES: &'static [(&'static str, Status)] = &[
|
|||
("macro_rules", Active),
|
||||
("struct_variant", Active),
|
||||
("once_fns", Active),
|
||||
("asm", Active),
|
||||
|
||||
// These are used to test this portion of the compiler, they don't actually
|
||||
// mean anything
|
||||
|
@ -108,26 +109,29 @@ impl Visitor<()> for Context {
|
|||
}
|
||||
}
|
||||
|
||||
ast::item_mac(ref mac) => {
|
||||
match mac.node {
|
||||
ast::mac_invoc_tt(ref path, _, _) => {
|
||||
let rules = self.sess.ident_of("macro_rules");
|
||||
if path.segments.last().identifier == rules {
|
||||
self.gate_feature("macro_rules", i.span,
|
||||
"macro definitions are not \
|
||||
stable enough for use and are \
|
||||
subject to change");
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
_ => {}
|
||||
}
|
||||
|
||||
visit::walk_item(self, i, ());
|
||||
}
|
||||
|
||||
fn visit_mac(&mut self, macro: &ast::mac, _: ()) {
|
||||
let ast::mac_invoc_tt(ref path, _, _) = macro.node;
|
||||
|
||||
if path.segments.last().identifier == self.sess.ident_of("macro_rules") {
|
||||
self.gate_feature("macro_rules", path.span, "macro definitions are \
|
||||
not stable enough for use and are subject to change");
|
||||
}
|
||||
|
||||
else if path.segments.last().identifier == self.sess.ident_of("asm") {
|
||||
// NOTE: remove the false once the ASM feature is in the next snapshot
|
||||
if false {
|
||||
self.gate_feature("asm", path.span, "inline assembly is not \
|
||||
stable enough for use and is subject to change");
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
fn visit_ty(&mut self, t: &ast::Ty, _: ()) {
|
||||
match t.node {
|
||||
ast::ty_closure(closure) if closure.onceness == ast::Once => {
|
||||
|
|
|
@ -90,6 +90,7 @@ pub trait Visitor<E:Clone> {
|
|||
walk_struct_def(self, s, i, g, n, e)
|
||||
}
|
||||
fn visit_struct_field(&mut self, s:@struct_field, e:E) { walk_struct_field(self, s, e) }
|
||||
fn visit_mac(&mut self, m:&mac, e:E) { walk_mac(self, m, e); }
|
||||
}
|
||||
|
||||
impl<E:Clone> Visitor<E> for @mut Visitor<E> {
|
||||
|
@ -150,6 +151,9 @@ impl<E:Clone> Visitor<E> for @mut Visitor<E> {
|
|||
fn visit_struct_field(&mut self, a:@struct_field, e:E) {
|
||||
(*self).visit_struct_field(a, e)
|
||||
}
|
||||
fn visit_mac(&mut self, macro:&mac, e:E) {
|
||||
(*self).visit_mac(macro, e);
|
||||
}
|
||||
}
|
||||
|
||||
pub fn walk_crate<E:Clone, V:Visitor<E>>(visitor: &mut V, crate: &Crate, env: E) {
|
||||
|
@ -247,7 +251,7 @@ pub fn walk_item<E:Clone, V:Visitor<E>>(visitor: &mut V, item: &item, env: E) {
|
|||
visitor.visit_trait_method(method, env.clone())
|
||||
}
|
||||
}
|
||||
item_mac(ref macro) => walk_mac(visitor, macro, env),
|
||||
item_mac(ref macro) => visitor.visit_mac(macro, env),
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -507,7 +511,7 @@ pub fn walk_stmt<E:Clone, V:Visitor<E>>(visitor: &mut V, statement: &Stmt, env:
|
|||
StmtExpr(expression, _) | StmtSemi(expression, _) => {
|
||||
visitor.visit_expr(expression, env)
|
||||
}
|
||||
StmtMac(ref macro, _) => walk_mac(visitor, macro, env),
|
||||
StmtMac(ref macro, _) => visitor.visit_mac(macro, env),
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -644,7 +648,7 @@ pub fn walk_expr<E:Clone, V:Visitor<E>>(visitor: &mut V, expression: @Expr, env:
|
|||
walk_expr_opt(visitor, optional_expression, env.clone())
|
||||
}
|
||||
ExprLogLevel => {}
|
||||
ExprMac(ref macro) => walk_mac(visitor, macro, env.clone()),
|
||||
ExprMac(ref macro) => visitor.visit_mac(macro, env.clone()),
|
||||
ExprParen(subexpression) => {
|
||||
visitor.visit_expr(subexpression, env.clone())
|
||||
}
|
||||
|
|
|
@ -0,0 +1,17 @@
|
|||
// Copyright 2013 The Rust Project Developers. See the COPYRIGHT
|
||||
// file at the top-level directory of this distribution and at
|
||||
// http://rust-lang.org/COPYRIGHT.
|
||||
//
|
||||
// Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or
|
||||
// http://www.apache.org/licenses/LICENSE-2.0> or the MIT license
|
||||
// <LICENSE-MIT or http://opensource.org/licenses/MIT>, at your
|
||||
// option. This file may not be copied, modified, or distributed
|
||||
// except according to those terms.
|
||||
|
||||
// xfail-test
|
||||
|
||||
fn main() {
|
||||
unsafe {
|
||||
asm!(""); //~ ERROR inline assembly is not stable enough
|
||||
}
|
||||
}
|
Loading…
Reference in New Issue