#![feature(box_syntax)]
#![feature(num_bits_bytes)]
#![feature(quote)]
-#![feature(ref_slice)]
#![feature(rustc_diagnostic_macros)]
#![feature(rustc_private)]
#![feature(slice_patterns)]
#[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
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);
)*}
)
}
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,
NonCamelCaseTypes,
NonSnakeCase,
NonUpperCaseGlobals,
- UnusedParens,
UnusedImportBraces,
NonShorthandFieldPatterns,
UnusedUnsafe,
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");