diff options
Diffstat (limited to 'src/libsyntax')
| -rw-r--r-- | src/libsyntax/ast.rs | 10 | ||||
| -rw-r--r-- | src/libsyntax/feature_gate.rs | 32 |
2 files changed, 13 insertions, 29 deletions
diff --git a/src/libsyntax/ast.rs b/src/libsyntax/ast.rs index 741feb4ba3d..40c98206c16 100644 --- a/src/libsyntax/ast.rs +++ b/src/libsyntax/ast.rs @@ -1903,6 +1903,16 @@ pub enum ViewPath_ { ViewPathList(Path, Vec<PathListItem>) } +impl ViewPath_ { + pub fn path(&self) -> &Path { + match *self { + ViewPathSimple(_, ref path) | + ViewPathGlob (ref path) | + ViewPathList(ref path, _) => path + } + } +} + /// Meta-data associated with an item pub type Attribute = Spanned<Attribute_>; diff --git a/src/libsyntax/feature_gate.rs b/src/libsyntax/feature_gate.rs index 08e593ca747..c11347f5762 100644 --- a/src/libsyntax/feature_gate.rs +++ b/src/libsyntax/feature_gate.rs @@ -956,22 +956,6 @@ impl<'a, 'v> Visitor<'v> for PostExpansionVisitor<'a> { visit::walk_item(self, i); } - fn visit_variant_data(&mut self, s: &'v ast::VariantData, _: ast::Ident, - _: &'v ast::Generics, _: ast::NodeId, span: Span) { - if s.fields().is_empty() { - if s.is_tuple() { - self.context.span_handler.struct_span_err(span, "empty tuple structs and enum \ - variants are not allowed, use \ - unit structs and enum variants \ - instead") - .span_help(span, "remove trailing `()` to make a unit \ - struct or unit enum variant") - .emit(); - } - } - visit::walk_struct_def(self, s) - } - fn visit_foreign_item(&mut self, i: &ast::ForeignItem) { let links_to_llvm = match attr::first_attr_value_str_by_name(&i.attrs, "link_name") { @@ -1142,22 +1126,12 @@ impl<'a, 'v> Visitor<'v> for PostExpansionVisitor<'a> { fn visit_vis(&mut self, vis: &'v ast::Visibility) { let span = match *vis { ast::Visibility::Crate(span) => span, - ast::Visibility::Restricted { ref path, .. } => { - // Check for type parameters - let found_param = path.segments.iter().any(|segment| { - !segment.parameters.types().is_empty() || - !segment.parameters.lifetimes().is_empty() || - !segment.parameters.bindings().is_empty() - }); - if found_param { - self.context.span_handler.span_err(path.span, "type or lifetime parameters \ - in visibility path"); - } - path.span - } + ast::Visibility::Restricted { ref path, .. } => path.span, _ => return, }; gate_feature_post!(&self, pub_restricted, span, "`pub(restricted)` syntax is experimental"); + + visit::walk_vis(self, vis) } } |
