Skip to content
Permalink
Browse files

lints: promote levels.rs to lint.rs & extract passes.rs

  • Loading branch information
Centril committed Jan 9, 2020
1 parent 16bf278 commit 03dfa642d9080a12e491681097806eb4207d19dc
@@ -1,12 +1,12 @@
use std::cmp;

use crate::ich::StableHashingContext;
use crate::lint::context::{CheckLintNameResult, LintStore};
use crate::lint::context::CheckLintNameResult;
use rustc_data_structures::fx::FxHashMap;
use rustc_data_structures::stable_hasher::{HashStable, StableHasher};
use rustc_errors::{struct_span_err, Applicability, DiagnosticBuilder, DiagnosticId};
use rustc_hir::HirId;
use rustc_session::lint::{builtin, Level, Lint, LintId};
pub use rustc_session::lint::{builtin, Level, Lint, LintId, LintPass};
use rustc_session::{DiagnosticMessageId, Session};
use rustc_span::hygiene::MacroKind;
use rustc_span::source_map::{DesugaringKind, ExpnKind, MultiSpan};
@@ -19,6 +19,14 @@ use syntax::sess::feature_err;

use rustc_error_codes::*;

mod context;
pub mod internal;
mod passes;

pub use context::add_elided_lifetime_in_path_suggestion;
pub use context::{EarlyContext, LateContext, LintContext, LintStore};
pub use passes::{EarlyLintPass, EarlyLintPassObject, LateLintPass, LateLintPassObject};

/// How a lint level was set.
#[derive(Clone, Copy, PartialEq, Eq, HashStable)]
pub enum LintSource {
@@ -17,8 +17,8 @@
use self::TargetLint::*;

use crate::hir::map::definitions::{DefPathData, DisambiguatedDefPathData};
use crate::lint::levels::LintLevelsBuilder;
use crate::lint::{EarlyLintPassObject, LateLintPassObject};
use crate::lint::passes::{EarlyLintPassObject, LateLintPassObject};
use crate::lint::LintLevelsBuilder;
use crate::middle::privacy::AccessLevels;
use crate::middle::stability;
use crate::ty::layout::{LayoutError, LayoutOf, TyLayout};
@@ -1,7 +1,8 @@
//! Some lints that are only useful in the compiler or crates that use compiler internals, such as
//! Clippy.

use crate::lint::{EarlyContext, EarlyLintPass, LateContext, LateLintPass, LintContext};
use crate::lint::context::{EarlyContext, LateContext, LintContext};
use crate::lint::passes::{EarlyLintPass, LateLintPass};
use rustc_data_structures::fx::FxHashMap;
use rustc_errors::Applicability;
use rustc_hir::{GenericArg, HirId, MutTy, Mutability, Path, PathSegment, QPath, Ty, TyKind};
@@ -18,8 +18,8 @@
//! example) requires more effort. See `emit_lint` and `GatherNodeLevels`
//! in `context.rs`.

pub use self::levels::LintSource::{self, *};
pub use self::Level::*;
pub use crate::lint::LintSource::{self, *};

use rustc_data_structures::sync;
use rustc_hir as hir;
@@ -308,9 +308,3 @@ macro_rules! declare_combined_early_lint_pass {
pub type EarlyLintPassObject = Box<dyn EarlyLintPass + sync::Send + sync::Sync + 'static>;
pub type LateLintPassObject =
Box<dyn for<'a, 'tcx> LateLintPass<'a, 'tcx> + sync::Send + sync::Sync + 'static>;

mod context;
pub mod internal;
mod levels;

pub use self::levels::{struct_lint_level, LintLevelMap, LintLevelSets, LintLevelsBuilder};
@@ -154,7 +154,7 @@ impl<'tcx> ConstEvalErr<'tcx> {
.next()
.unwrap_or(lint_root);
tcx.struct_span_lint_hir(
crate::rustc::lint::builtin::CONST_ERR,
rustc_session::lint::builtin::CONST_ERR,
hir_id,
tcx.span,
message,
@@ -1,8 +1,9 @@
use rustc::lint::{FutureIncompatibleInfo, LateContext, LateLintPass, LintContext};
use rustc::lint::{LateContext, LateLintPass, LintContext};
use rustc::ty;
use rustc::ty::adjustment::{Adjust, Adjustment};
use rustc_errors::Applicability;
use rustc_hir as hir;
use rustc_session::lint::FutureIncompatibleInfo;
use rustc_span::symbol::sym;

declare_lint! {
@@ -3,7 +3,6 @@
// from live codes are live, and everything else is dead.

use rustc::hir::map::Map;
use rustc::lint;
use rustc::middle::codegen_fn_attrs::CodegenFnAttrFlags;
use rustc::middle::privacy;
use rustc::ty::{self, DefIdTree, TyCtxt};
@@ -14,6 +13,7 @@ use rustc_hir::def_id::{DefId, LOCAL_CRATE};
use rustc_hir::intravisit::{self, NestedVisitorMap, Visitor};
use rustc_hir::itemlikevisit::ItemLikeVisitor;
use rustc_hir::{Node, PatKind, TyKind};
use rustc_session::lint;

use rustc_span;
use rustc_span::symbol::sym;
@@ -1,4 +1,3 @@
use rustc::lint;
use rustc::middle::cstore::CrateStore;
use rustc::middle::privacy::AccessLevels;
use rustc::session::config::ErrorOutputType;
@@ -14,6 +13,7 @@ use rustc_hir::HirId;
use rustc_interface::interface;
use rustc_lint;
use rustc_resolve as resolve;
use rustc_session::lint;

use rustc_errors::emitter::{Emitter, EmitterWriter};
use rustc_errors::json::JsonEmitter;
@@ -36,6 +36,7 @@ extern crate rustc_metadata;
extern crate rustc_mir;
extern crate rustc_parse;
extern crate rustc_resolve;
extern crate rustc_session;
extern crate rustc_span as rustc_span;
extern crate rustc_target;
extern crate rustc_typeck;

0 comments on commit 03dfa64

Please sign in to comment.
You can’t perform that action at this time.