]> git.lizzy.rs Git - rust.git/commitdiff
Auto merge of #51678 - Zoxc:combine-lints, r=estebank
authorbors <bors@rust-lang.org>
Tue, 26 Jun 2018 14:18:13 +0000 (14:18 +0000)
committerbors <bors@rust-lang.org>
Tue, 26 Jun 2018 14:18:13 +0000 (14:18 +0000)
Combine all builtin late lints

1  2 
src/librustc_lint/lib.rs
src/librustdoc/core.rs

diff --combined src/librustc_lint/lib.rs
index 1d443258dc6423dd93c715aaff3f0e1149e8a761,f84bfd66a6368904a72901494bb66534e3d9448b..11bca9b4a2d0b00d0c073612ab5f5900ab020075
@@@ -41,9 -41,14 +41,14 @@@ extern crate rustc_target
  extern crate syntax_pos;
  
  use rustc::lint;
+ use rustc::lint::{LateContext, LateLintPass, LintPass, LintArray};
  use rustc::lint::builtin::{BARE_TRAIT_OBJECTS, ABSOLUTE_PATHS_NOT_STARTING_WITH_CRATE};
  use rustc::session;
  use rustc::util;
+ use rustc::hir;
+ use syntax::ast;
+ use syntax_pos::Span;
  
  use session::Session;
  use syntax::edition::Edition;
@@@ -67,14 -72,6 +72,6 @@@ pub use builtin::SoftLints
  /// defined in this crate and the ones defined in
  /// `rustc::lint::builtin`).
  pub fn register_builtins(store: &mut lint::LintStore, sess: Option<&Session>) {
-     macro_rules! add_builtin {
-         ($sess:ident, $($name:ident),*,) => (
-             {$(
-                 store.register_late_pass($sess, false, box $name);
-                 )*}
-             )
-     }
      macro_rules! add_early_builtin {
          ($sess:ident, $($name:ident),*,) => (
              {$(
              )
      }
  
-     macro_rules! add_builtin_with_new {
-         ($sess:ident, $($name:ident),*,) => (
-             {$(
-                 store.register_late_pass($sess, false, box $name::new());
-                 )*}
-             )
-     }
      macro_rules! add_early_builtin_with_new {
          ($sess:ident, $($name:ident),*,) => (
              {$(
                                  DeprecatedAttr,
                                  );
  
-     add_builtin!(sess,
-                  HardwiredLints,
-                  WhileTrue,
-                  ImproperCTypes,
-                  VariantSizeDifferences,
-                  BoxPointers,
-                  UnusedAttributes,
-                  PathStatements,
-                  UnusedResults,
-                  NonCamelCaseTypes,
-                  NonSnakeCase,
-                  NonUpperCaseGlobals,
-                  NonShorthandFieldPatterns,
-                  UnsafeCode,
-                  UnusedAllocation,
-                  MissingCopyImplementations,
-                  UnstableFeatures,
-                  UnconditionalRecursion,
-                  InvalidNoMangleItems,
-                  PluginAsLibrary,
-                  MutableTransmutes,
-                  UnionsWithDropFields,
-                  UnreachablePub,
-                  TypeAliasBounds,
-                  UnusedBrokenConst,
-                  TrivialConstraints,
-                  );
-     add_builtin_with_new!(sess,
-                           TypeLimits,
-                           MissingDoc,
-                           MissingDebugImplementations,
-                           );
+     late_lint_methods!(declare_combined_late_lint_pass, [BuiltinCombinedLateLintPass, [
+         HardwiredLints: HardwiredLints,
+         WhileTrue: WhileTrue,
+         ImproperCTypes: ImproperCTypes,
+         VariantSizeDifferences: VariantSizeDifferences,
+         BoxPointers: BoxPointers,
+         UnusedAttributes: UnusedAttributes,
+         PathStatements: PathStatements,
+         UnusedResults: UnusedResults,
+         NonCamelCaseTypes: NonCamelCaseTypes,
+         NonSnakeCase: NonSnakeCase,
+         NonUpperCaseGlobals: NonUpperCaseGlobals,
+         NonShorthandFieldPatterns: NonShorthandFieldPatterns,
+         UnsafeCode: UnsafeCode,
+         UnusedAllocation: UnusedAllocation,
+         MissingCopyImplementations: MissingCopyImplementations,
+         UnstableFeatures: UnstableFeatures,
+         UnconditionalRecursion: UnconditionalRecursion,
+         InvalidNoMangleItems: InvalidNoMangleItems,
+         PluginAsLibrary: PluginAsLibrary,
+         MutableTransmutes: MutableTransmutes,
+         UnionsWithDropFields: UnionsWithDropFields,
+         UnreachablePub: UnreachablePub,
+         TypeAliasBounds: TypeAliasBounds,
+         UnusedBrokenConst: UnusedBrokenConst,
+         TrivialConstraints: TrivialConstraints,
+         TypeLimits: TypeLimits::new(),
+         MissingDoc: MissingDoc::new(),
+         MissingDebugImplementations: MissingDebugImplementations::new(),
+     ]], ['tcx]);
+     store.register_late_pass(sess, false, box BuiltinCombinedLateLintPass::new());
  
      add_lint_group!(sess,
                      "bad_style",
              reference: "issue TBD",
              edition: Some(Edition::Edition2018),
          },
 +        FutureIncompatibleInfo {
 +            id: LintId::of(WHERE_CLAUSES_OBJECT_SAFETY),
 +            reference: "issue #51443 <https://github.com/rust-lang/rust/issues/51443>",
 +            edition: None,
 +        },
          FutureIncompatibleInfo {
              id: LintId::of(DUPLICATE_ASSOCIATED_TYPE_BINDINGS),
              reference: "issue #50589 <https://github.com/rust-lang/rust/issues/50589>",
diff --combined src/librustdoc/core.rs
index 53ebb3a12f527e637bfe3b84938f2e6c816d9d79,2d71b48d8ac1e309a9a4e7c5c3d82d8b5c2ebba6..ddc9bdb384c0b359812661b4ac37058adeae0578
@@@ -77,7 -77,7 +77,7 @@@ pub struct DocContext<'a, 'tcx: 'a, 'rc
      /// Table node id of lifetime parameter definition -> substituted lifetime
      pub lt_substs: RefCell<FxHashMap<DefId, clean::Lifetime>>,
      /// Table DefId of `impl Trait` in argument position -> bounds
 -    pub impl_trait_bounds: RefCell<FxHashMap<DefId, Vec<clean::TyParamBound>>>,
 +    pub impl_trait_bounds: RefCell<FxHashMap<DefId, Vec<clean::GenericBound>>>,
      pub send_trait: Option<DefId>,
      pub fake_def_ids: RefCell<FxHashMap<CrateNum, DefId>>,
      pub all_fake_def_ids: RefCell<FxHashSet<DefId>>,
@@@ -190,8 -190,8 +190,8 @@@ pub fn run_core(search_paths: SearchPat
      let intra_link_resolution_failure_name = lint::builtin::INTRA_DOC_LINK_RESOLUTION_FAILURE.name;
      let warnings_lint_name = lint::builtin::WARNINGS.name;
      let lints = lint::builtin::HardwiredLints.get_lints()
-                     .iter()
-                     .chain(rustc_lint::SoftLints.get_lints())
+                     .into_iter()
+                     .chain(rustc_lint::SoftLints.get_lints().into_iter())
                      .filter_map(|lint| {
                          if lint.name == warnings_lint_name ||
                             lint.name == intra_link_resolution_failure_name {