]> git.lizzy.rs Git - rust.git/blobdiff - src/librustc/front/feature_gate.rs
Doc says to avoid mixing allocator instead of forbiding it
[rust.git] / src / librustc / front / feature_gate.rs
index b3653b5dcffb296cbb9bf481cdad17f7e525b4e6..13a40aba93078321db65640e5d255ffc975e672a 100644 (file)
@@ -33,6 +33,7 @@
 use driver::session::Session;
 
 use std::cell::Cell;
+use std::slice;
 
 /// This is a list of all known features since the beginning of time. This list
 /// can never shrink, it may only be expanded (in order to prevent old programs
@@ -143,7 +144,7 @@ fn has_feature(&self, feature: &str) -> bool {
     }
 }
 
-impl<'a> Visitor for Context<'a> {
+impl<'a, 'v> Visitor<'v> for Context<'a> {
     fn visit_ident(&mut self, sp: Span, id: ast::Ident) {
         if !token::get_ident(id).get().is_ascii() {
             self.gate_feature("non_ascii_idents", sp,
@@ -220,7 +221,7 @@ fn visit_item(&mut self, i: &ast::Item) {
                 }
             }
 
-            ast::ItemStruct(struct_definition, _) => {
+            ast::ItemStruct(ref struct_definition, _) => {
                 if attr::contains_name(i.attrs.as_slice(), "simd") {
                     self.gate_feature("simd", i.span,
                                       "SIMD types are experimental and possibly buggy");
@@ -310,7 +311,7 @@ fn visit_foreign_item(&mut self, i: &ast::ForeignItem) {
 
     fn visit_ty(&mut self, t: &ast::Ty) {
         match t.node {
-            ast::TyClosure(closure) if closure.onceness == ast::Once => {
+            ast::TyClosure(ref closure) if closure.onceness == ast::Once => {
                 self.gate_feature("once_fns", t.span,
                                   "once functions are \
                                    experimental and likely to be removed");
@@ -352,7 +353,7 @@ fn visit_expr(&mut self, e: &ast::Expr) {
     fn visit_generics(&mut self, generics: &ast::Generics) {
         for type_parameter in generics.ty_params.iter() {
             match type_parameter.default {
-                Some(ty) => {
+                Some(ref ty) => {
                     self.gate_feature("default_type_params", ty.span,
                                       "default type parameters are \
                                        experimental and possibly buggy");
@@ -364,7 +365,7 @@ fn visit_generics(&mut self, generics: &ast::Generics) {
     }
 
     fn visit_attribute(&mut self, attr: &ast::Attribute) {
-        if attr::contains_name([*attr], "lang") {
+        if attr::contains_name(slice::ref_slice(attr), "lang") {
             self.gate_feature("lang_items",
                               attr.span,
                               "language items are subject to change");
@@ -386,13 +387,13 @@ fn visit_pat(&mut self, pattern: &ast::Pat) {
     }
 
     fn visit_fn(&mut self,
-                fn_kind: &visit::FnKind,
-                fn_decl: &ast::FnDecl,
-                block: &ast::Block,
+                fn_kind: visit::FnKind<'v>,
+                fn_decl: &'v ast::FnDecl,
+                block: &'v ast::Block,
                 span: Span,
                 _: NodeId) {
-        match *fn_kind {
-            visit::FkItemFn(_, _, _, ref abi) if *abi == RustIntrinsic => {
+        match fn_kind {
+            visit::FkItemFn(_, _, _, abi) if abi == RustIntrinsic => {
                 self.gate_feature("intrinsics",
                                   span,
                                   "intrinsics are subject to change")
@@ -420,7 +421,7 @@ pub fn check_crate(sess: &Session, krate: &ast::Crate) {
                                           expected #![feature(...)]");
             }
             Some(list) => {
-                for &mi in list.iter() {
+                for mi in list.iter() {
                     let name = match mi.node {
                         ast::MetaWord(ref word) => (*word).clone(),
                         _ => {