]> git.lizzy.rs Git - rust.git/blobdiff - src/librustc_lint/lib.rs
Auto merge of #29291 - petrochenkov:privacy, r=alexcrichton
[rust.git] / src / librustc_lint / lib.rs
index 517a3d13ddf76d810fcf7b51b6f986a487e5b3d6..920e0341372ba6afa47896911eecb46a6520669e 100644 (file)
@@ -35,7 +35,6 @@
 #![feature(box_syntax)]
 #![feature(num_bits_bytes)]
 #![feature(quote)]
-#![feature(ref_slice)]
 #![feature(rustc_diagnostic_macros)]
 #![feature(rustc_private)]
 #![feature(slice_patterns)]
@@ -48,6 +47,7 @@
 #[macro_use]
 extern crate log;
 extern crate rustc_front;
+extern crate rustc_back;
 
 pub use rustc::lint as lint;
 pub use rustc::metadata as metadata;
 use session::Session;
 use lint::LintId;
 
+mod bad_style;
 mod builtin;
+mod types;
+mod unused;
+
+use bad_style::*;
+use builtin::*;
+use types::*;
+use unused::*;
 
 /// Tell the `LintStore` about all the built-in lints (the ones
 /// defined in this crate and the ones defined in
@@ -67,7 +75,15 @@ pub fn register_builtins(store: &mut lint::LintStore, sess: Option<&Session>) {
     macro_rules! add_builtin {
         ($sess:ident, $($name:ident),*,) => (
             {$(
-                store.register_pass($sess, false, box builtin::$name);
+                store.register_late_pass($sess, false, box $name);
+                )*}
+            )
+    }
+
+    macro_rules! add_early_builtin {
+        ($sess:ident, $($name:ident),*,) => (
+            {$(
+                store.register_early_pass($sess, false, box $name);
                 )*}
             )
     }
@@ -75,17 +91,21 @@ macro_rules! add_builtin {
     macro_rules! add_builtin_with_new {
         ($sess:ident, $($name:ident),*,) => (
             {$(
-                store.register_pass($sess, false, box builtin::$name::new());
+                store.register_late_pass($sess, false, box $name::new());
                 )*}
             )
     }
 
     macro_rules! add_lint_group {
         ($sess:ident, $name:expr, $($lint:ident),*) => (
-            store.register_group($sess, false, $name, vec![$(LintId::of(builtin::$lint)),*]);
+            store.register_group($sess, false, $name, vec![$(LintId::of($lint)),*]);
             )
     }
 
+    add_early_builtin!(sess,
+                       UnusedParens,
+                       );
+
     add_builtin!(sess,
                  HardwiredLints,
                  WhileTrue,
@@ -97,7 +117,6 @@ macro_rules! add_lint_group {
                  NonCamelCaseTypes,
                  NonSnakeCase,
                  NonUpperCaseGlobals,
-                 UnusedParens,
                  UnusedImportBraces,
                  NonShorthandFieldPatterns,
                  UnusedUnsafe,
@@ -127,10 +146,10 @@ macro_rules! add_lint_group {
     add_lint_group!(sess, "unused",
                     UNUSED_IMPORTS, UNUSED_VARIABLES, UNUSED_ASSIGNMENTS, DEAD_CODE,
                     UNUSED_MUT, UNREACHABLE_CODE, UNUSED_MUST_USE,
-                    UNUSED_UNSAFE, PATH_STATEMENTS);
+                    UNUSED_UNSAFE, PATH_STATEMENTS, UNUSED_ATTRIBUTES);
 
     // We have one lint pass defined specially
-    store.register_pass(sess, false, box lint::GatherNodeLevels);
+    store.register_late_pass(sess, false, box lint::GatherNodeLevels);
 
     // Insert temporary renamings for a one-time deprecation
     store.register_renamed("raw_pointer_deriving", "raw_pointer_derive");