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)[]);
}
}
}
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 \
}
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");
}
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",
"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,
}
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")
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,