X-Git-Url: https://git.lizzy.rs/?a=blobdiff_plain;f=src%2Flibrustc_passes%2Fast_validation.rs;h=3d0e46d998622e2791e6f8ba093b2843b3bc91de;hb=cbe377b2f5e709b35cee2bfb683b4f6a508a750f;hp=b878a330ab6490b562e54d0eeae0d97c731176dd;hpb=99e3fca27d141e2d100ebaf5d5a4104234ae201a;p=rust.git diff --git a/src/librustc_passes/ast_validation.rs b/src/librustc_passes/ast_validation.rs index b878a330ab6..3d0e46d9986 100644 --- a/src/librustc_passes/ast_validation.rs +++ b/src/librustc_passes/ast_validation.rs @@ -1,13 +1,3 @@ -// Copyright 2016 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 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - // Validate AST before lowering it to HIR // // This pass is supposed to catch things that fit into AST data structures, @@ -288,25 +278,6 @@ fn visit_ty(&mut self, ty: &'a Ty) { visit::walk_ty(self, ty) } - fn visit_use_tree(&mut self, use_tree: &'a UseTree, id: NodeId, _nested: bool) { - // Check if the path in this `use` is not generic, such as `use foo::bar;` While this - // can't happen normally thanks to the parser, a generic might sneak in if the `use` is - // built using a macro. - // - // macro_use foo { - // ($p:path) => { use $p; } - // } - // foo!(bar::baz); - use_tree.prefix.segments.iter().find(|segment| { - segment.args.is_some() - }).map(|segment| { - self.err_handler().span_err(segment.args.as_ref().unwrap().span(), - "generic arguments in import path"); - }); - - visit::walk_use_tree(self, use_tree, id); - } - fn visit_label(&mut self, label: &'a Label) { self.check_label(label.ident); visit::walk_label(self, label); @@ -404,7 +375,7 @@ fn visit_item(&mut self, item: &'a Item) { } } ItemKind::Mod(_) => { - // Ensure that `path` attributes on modules are recorded as used (c.f. #35584). + // Ensure that `path` attributes on modules are recorded as used (cf. issue #35584). attr::first_attr_value_str_by_name(&item.attrs, "path"); if attr::contains_name(&item.attrs, "warn_directory_ownership") { let lint = lint::builtin::LEGACY_DIRECTORY_OWNERSHIP; @@ -443,17 +414,6 @@ fn visit_foreign_item(&mut self, fi: &'a ForeignItem) { visit::walk_foreign_item(self, fi) } - fn visit_vis(&mut self, vis: &'a Visibility) { - if let VisibilityKind::Restricted { ref path, .. } = vis.node { - path.segments.iter().find(|segment| segment.args.is_some()).map(|segment| { - self.err_handler().span_err(segment.args.as_ref().unwrap().span(), - "generic arguments in visibility path"); - }); - } - - visit::walk_vis(self, vis) - } - fn visit_generics(&mut self, generics: &'a Generics) { let mut seen_non_lifetime_param = false; let mut seen_default = None; @@ -478,8 +438,9 @@ fn visit_generics(&mut self, generics: &'a Generics) { } for predicate in &generics.where_clause.predicates { if let WherePredicate::EqPredicate(ref predicate) = *predicate { - self.err_handler().span_err(predicate.span, "equality constraints are not yet \ - supported in where clauses (#20041)"); + self.err_handler() + .span_err(predicate.span, "equality constraints are not yet \ + supported in where clauses (see #20041)"); } } visit::walk_generics(self, generics) @@ -529,7 +490,7 @@ fn visit_mac(&mut self, mac: &Spanned) { } } -// Bans nested `impl Trait`, e.g. `impl Into`. +// Bans nested `impl Trait`, e.g., `impl Into`. // Nested `impl Trait` _is_ allowed in associated type position, // e.g `impl Iterator` struct NestedImplTraitVisitor<'a> {