]> git.lizzy.rs Git - rust.git/blobdiff - src/libsyntax/feature_gate.rs
rollup merge of #20723: pnkfelix/feature-gate-box-syntax
[rust.git] / src / libsyntax / feature_gate.rs
index fbff5e16ef5f755b5da16798b72f32a888a32b18..2cfcd38d48fca9d4be9034fb232dd48bbfbb7dd8 100644 (file)
@@ -151,9 +151,9 @@ impl<'a> Context<'a> {
     fn gate_feature(&self, feature: &str, span: Span, explain: &str) {
         if !self.has_feature(feature) {
             self.span_handler.span_err(span, explain);
-            self.span_handler.span_help(span, format!("add #![feature({})] to the \
+            self.span_handler.span_help(span, &format!("add #![feature({})] to the \
                                                        crate attributes to enable",
-                                                      feature).index(&FullRange));
+                                                      feature)[]);
         }
     }
 
@@ -244,7 +244,7 @@ fn visit_item(&mut self, i: &ast::Item) {
         }
         match i.node {
             ast::ItemForeignMod(ref foreign_module) => {
-                if attr::contains_name(i.attrs.index(&FullRange), "link_args") {
+                if attr::contains_name(&i.attrs[], "link_args") {
                     self.gate_feature("link_args", i.span,
                                       "the `link_args` attribute is not portable \
                                        across platforms, it is recommended to \
@@ -258,14 +258,14 @@ fn visit_item(&mut self, i: &ast::Item) {
             }
 
             ast::ItemFn(..) => {
-                if attr::contains_name(i.attrs.index(&FullRange), "plugin_registrar") {
+                if attr::contains_name(&i.attrs[], "plugin_registrar") {
                     self.gate_feature("plugin_registrar", i.span,
                                       "compiler plugins are experimental and possibly buggy");
                 }
             }
 
             ast::ItemStruct(..) => {
-                if attr::contains_name(i.attrs.index(&FullRange), "simd") {
+                if attr::contains_name(&i.attrs[], "simd") {
                     self.gate_feature("simd", i.span,
                                       "SIMD types are experimental and possibly buggy");
                 }
@@ -291,7 +291,7 @@ fn visit_item(&mut self, i: &ast::Item) {
                                        removed in the future");
                 }
 
-                if attr::contains_name(i.attrs.index(&FullRange),
+                if attr::contains_name(&i.attrs[],
                                        "old_orphan_check") {
                     self.gate_feature(
                         "old_orphan_check",
@@ -299,7 +299,7 @@ fn visit_item(&mut self, i: &ast::Item) {
                         "the new orphan check rules will eventually be strictly enforced");
                 }
 
-                if attr::contains_name(i.attrs.index(&FullRange),
+                if attr::contains_name(&i.attrs[],
                                        "old_impl_check") {
                     self.gate_feature("old_impl_check",
                                       i.span,
@@ -314,7 +314,7 @@ fn visit_item(&mut self, i: &ast::Item) {
     }
 
     fn visit_foreign_item(&mut self, i: &ast::ForeignItem) {
-        if attr::contains_name(i.attrs.index(&FullRange), "linkage") {
+        if attr::contains_name(&i.attrs[], "linkage") {
             self.gate_feature("linkage", i.span,
                               "the `linkage` attribute is experimental \
                                and not portable across platforms")
@@ -339,11 +339,6 @@ fn visit_ty(&mut self, t: &ast::Ty) {
 
     fn visit_expr(&mut self, e: &ast::Expr) {
         match e.node {
-            ast::ExprRange(..) => {
-                self.gate_feature("slicing_syntax",
-                                  e.span,
-                                  "range syntax is experimental");
-            }
             ast::ExprBox(..) | ast::ExprUnary(ast::UnOp::UnUniq, _) => {
                 self.gate_feature("box_syntax",
                                   e.span,