diff --git a/src/librustc_driver/driver.rs b/src/librustc_driver/driver.rs index 570135e0713..95be6d5b623 100644 --- a/src/librustc_driver/driver.rs +++ b/src/librustc_driver/driver.rs @@ -38,7 +38,7 @@ use rustc_privacy; use rustc_plugin::registry::Registry; use rustc_plugin as plugin; use rustc::hir::lowering::lower_crate; -use rustc_passes::{ast_sanity, no_asm, loops, consts, rvalues, static_recursion}; +use rustc_passes::{ast_validation, no_asm, loops, consts, rvalues, static_recursion}; use rustc_const_eval::check_match; use super::Compilation; @@ -167,8 +167,8 @@ pub fn compile_input(sess: &Session, || lint::check_ast_crate(sess, &expanded_crate)); time(sess.time_passes(), - "AST sanity checking", - || ast_sanity::check_crate(sess, &expanded_crate)); + "AST validation", + || ast_validation::check_crate(sess, &expanded_crate)); let (analysis, resolutions, mut hir_forest) = { lower_and_resolve(sess, &id, &mut defs, &expanded_crate, diff --git a/src/librustc_passes/ast_sanity.rs b/src/librustc_passes/ast_validation.rs similarity index 95% rename from src/librustc_passes/ast_sanity.rs rename to src/librustc_passes/ast_validation.rs index e22b3dfb81c..919c717f888 100644 --- a/src/librustc_passes/ast_sanity.rs +++ b/src/librustc_passes/ast_validation.rs @@ -8,7 +8,7 @@ // option. This file may not be copied, modified, or distributed // except according to those terms. -// Sanity check AST before lowering it to HIR +// Validate AST before lowering it to HIR // // This pass is supposed to catch things that fit into AST data structures, // but not permitted by the language. It runs after expansion when AST is frozen, @@ -24,11 +24,11 @@ use syntax::errors; use syntax::parse::token::{self, keywords}; use syntax::visit::{self, Visitor}; -struct SanityChecker<'a> { +struct AstValidator<'a> { session: &'a Session, } -impl<'a> SanityChecker<'a> { +impl<'a> AstValidator<'a> { fn err_handler(&self) -> &errors::Handler { &self.session.parse_sess.span_diagnostic } @@ -57,7 +57,7 @@ impl<'a> SanityChecker<'a> { } } -impl<'a, 'v> Visitor<'v> for SanityChecker<'a> { +impl<'a, 'v> Visitor<'v> for AstValidator<'a> { fn visit_lifetime(&mut self, lt: &Lifetime) { if lt.name.as_str() == "'_" { self.session.add_lint( @@ -72,9 +72,7 @@ impl<'a, 'v> Visitor<'v> for SanityChecker<'a> { fn visit_expr(&mut self, expr: &Expr) { match expr.node { ExprKind::While(_, _, Some(ident)) | ExprKind::Loop(_, Some(ident)) | - ExprKind::WhileLet(_, _, _, Some(ident)) | ExprKind::ForLoop(_, _, _, Some(ident)) => { - self.check_label(ident, expr.span, expr.id); - } + ExprKind::WhileLet(_, _, _, Some(ident)) | ExprKind::ForLoop(_, _, _, Some(ident)) | ExprKind::Break(Some(ident)) | ExprKind::Again(Some(ident)) => { self.check_label(ident.node, ident.span, expr.id); } @@ -169,5 +167,5 @@ impl<'a, 'v> Visitor<'v> for SanityChecker<'a> { } pub fn check_crate(session: &Session, krate: &Crate) { - visit::walk_crate(&mut SanityChecker { session: session }, krate) + visit::walk_crate(&mut AstValidator { session: session }, krate) } diff --git a/src/librustc_passes/lib.rs b/src/librustc_passes/lib.rs index 9e5cc139040..1576ca6bdea 100644 --- a/src/librustc_passes/lib.rs +++ b/src/librustc_passes/lib.rs @@ -37,7 +37,7 @@ extern crate rustc_const_math; pub mod diagnostics; -pub mod ast_sanity; +pub mod ast_validation; pub mod consts; pub mod loops; pub mod no_asm; diff --git a/src/rustc/Cargo.lock b/src/rustc/Cargo.lock index 7a63742fba3..931f90a2394 100644 --- a/src/rustc/Cargo.lock +++ b/src/rustc/Cargo.lock @@ -246,7 +246,6 @@ dependencies = [ name = "rustc_privacy" version = "0.0.0" dependencies = [ - "log 0.0.0", "rustc 0.0.0", "syntax 0.0.0", ] diff --git a/src/test/compile-fail/use-super-global-path.rs b/src/test/compile-fail/use-super-global-path.rs index c4d18a94eb2..1d0d60a775f 100644 --- a/src/test/compile-fail/use-super-global-path.rs +++ b/src/test/compile-fail/use-super-global-path.rs @@ -9,8 +9,15 @@ // except according to those terms. #![feature(rustc_attrs)] +#![allow(unused_imports, dead_code)] + +struct S; +struct Z; mod foo { + use ::super::{S, Z}; //~ WARN global paths cannot start with `super` + //~^ WARN this was previously accepted by the compiler but is being phased out + pub fn g() { use ::super::main; //~ WARN global paths cannot start with `super` //~^ WARN this was previously accepted by the compiler but is being phased out