-// 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 <LICENSE-APACHE or
-// http://www.apache.org/licenses/LICENSE-2.0> or the MIT license
-// <LICENSE-MIT or http://opensource.org/licenses/MIT>, 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,
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<T>;` 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<T>);
- 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);
}
}
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;
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;
}
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)
}
}
-// Bans nested `impl Trait`, e.g. `impl Into<impl Debug>`.
+// Bans nested `impl Trait`, e.g., `impl Into<impl Debug>`.
// Nested `impl Trait` _is_ allowed in associated type position,
// e.g `impl Iterator<Item=impl Debug>`
struct NestedImplTraitVisitor<'a> {