Skip to content

Commit 3a2af32

Browse files
committed
canonicalize some lint imports
1 parent 88d1109 commit 3a2af32

File tree

10 files changed

+33
-31
lines changed

10 files changed

+33
-31
lines changed

src/librustc/hir/check_attr.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,6 @@
55
//! item.
66
77
use crate::hir::map::Map;
8-
use crate::lint::builtin::UNUSED_ATTRIBUTES;
98
use crate::ty::query::Providers;
109
use crate::ty::TyCtxt;
1110

@@ -16,6 +15,7 @@ use rustc_hir::def_id::DefId;
1615
use rustc_hir::intravisit::{self, NestedVisitorMap, Visitor};
1716
use rustc_hir::DUMMY_HIR_ID;
1817
use rustc_hir::{self, HirId, Item, ItemKind, TraitItem, TraitItemKind};
18+
use rustc_session::lint::builtin::UNUSED_ATTRIBUTES;
1919
use rustc_span::symbol::sym;
2020
use rustc_span::Span;
2121
use syntax::ast::Attribute;

src/librustc/lint/context.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -16,12 +16,11 @@
1616
1717
use self::TargetLint::*;
1818

19-
use crate::hir::map::{definitions::DisambiguatedDefPathData, DefPathData};
19+
use crate::hir::map::definitions::{DefPathData, DisambiguatedDefPathData};
2020
use crate::lint::levels::{LintLevelSets, LintLevelsBuilder};
2121
use crate::lint::{EarlyLintPassObject, LateLintPassObject};
2222
use crate::middle::privacy::AccessLevels;
2323
use crate::middle::stability;
24-
use crate::session::Session;
2524
use crate::ty::layout::{LayoutError, LayoutOf, TyLayout};
2625
use crate::ty::{self, print::Printer, subst::GenericArg, Ty, TyCtxt};
2726
use rustc_data_structures::fx::FxHashMap;
@@ -32,6 +31,7 @@ use rustc_hir as hir;
3231
use rustc_hir::def_id::{CrateNum, DefId};
3332
use rustc_session::lint::BuiltinLintDiagnostics;
3433
use rustc_session::lint::{FutureIncompatibleInfo, Level, Lint, LintBuffer, LintId};
34+
use rustc_session::Session;
3535
use rustc_span::{symbol::Symbol, MultiSpan, Span, DUMMY_SP};
3636
use syntax::ast;
3737
use syntax::util::lev_distance::find_best_match_for_name;

src/librustc/lint/levels.rs

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,14 +1,14 @@
11
use std::cmp;
22

33
use crate::ich::StableHashingContext;
4-
use crate::lint::builtin;
54
use crate::lint::context::{CheckLintNameResult, LintStore};
6-
use crate::lint::{self, Level, Lint, LintId, LintSource};
7-
use crate::session::Session;
5+
use crate::lint::{self, LintSource};
86
use rustc_data_structures::fx::FxHashMap;
97
use rustc_data_structures::stable_hasher::{HashStable, StableHasher};
108
use rustc_errors::{struct_span_err, Applicability, DiagnosticBuilder};
119
use rustc_hir::HirId;
10+
use rustc_session::lint::{builtin, Level, Lint, LintId};
11+
use rustc_session::Session;
1212
use rustc_span::source_map::MultiSpan;
1313
use rustc_span::symbol::{sym, Symbol};
1414
use syntax::ast;

src/librustc/middle/stability.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33
44
pub use self::StabilityLevel::*;
55

6-
use crate::lint::{self, in_derive_expansion, Lint};
6+
use crate::lint::in_derive_expansion;
77
use crate::session::{DiagnosticMessageId, Session};
88
use crate::ty::{self, TyCtxt};
99
use rustc_data_structures::fx::{FxHashMap, FxHashSet};
@@ -13,7 +13,7 @@ use rustc_hir as hir;
1313
use rustc_hir::def::DefKind;
1414
use rustc_hir::def_id::{CrateNum, DefId, CRATE_DEF_INDEX};
1515
use rustc_hir::{self, HirId};
16-
use rustc_session::lint::{BuiltinLintDiagnostics, LintBuffer};
16+
use rustc_session::lint::{self, BuiltinLintDiagnostics, Lint, LintBuffer};
1717
use rustc_span::symbol::{sym, Symbol};
1818
use rustc_span::{MultiSpan, Span};
1919
use syntax::ast::CRATE_NODE_ID;

src/librustc/query/mod.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -82,7 +82,7 @@ rustc_queries! {
8282
desc { "looking up the native libraries of a linked crate" }
8383
}
8484

85-
query lint_levels(_: CrateNum) -> &'tcx lint::LintLevelMap {
85+
query lint_levels(_: CrateNum) -> &'tcx LintLevelMap {
8686
eval_always
8787
desc { "computing the lint levels for items in this crate" }
8888
}

src/librustc/traits/object_safety.rs

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -10,17 +10,18 @@
1010
1111
use super::elaborate_predicates;
1212

13-
use crate::lint;
1413
use crate::traits::{self, Obligation, ObligationCause};
1514
use crate::ty::subst::{InternalSubsts, Subst};
1615
use crate::ty::{self, Predicate, ToPredicate, Ty, TyCtxt, TypeFoldable};
1716
use rustc_hir as hir;
1817
use rustc_hir::def_id::DefId;
18+
use rustc_session::lint::builtin::WHERE_CLAUSES_OBJECT_SAFETY;
1919
use rustc_span::symbol::Symbol;
2020
use rustc_span::{Span, DUMMY_SP};
21+
use syntax::ast;
22+
2123
use std::borrow::Cow;
2224
use std::iter::{self};
23-
use syntax::ast::{self};
2425

2526
#[derive(Copy, Clone, Debug, PartialEq, Eq, Hash)]
2627
pub enum ObjectSafetyViolation {
@@ -179,7 +180,7 @@ fn object_safety_violations_for_trait(
179180
// Using `CRATE_NODE_ID` is wrong, but it's hard to get a more precise id.
180181
// It's also hard to get a use site span, so we use the method definition span.
181182
tcx.lint_node_note(
182-
lint::builtin::WHERE_CLAUSES_OBJECT_SAFETY,
183+
WHERE_CLAUSES_OBJECT_SAFETY,
183184
hir::CRATE_HIR_ID,
184185
*span,
185186
&format!(

src/librustc/traits/specialize/mod.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -12,14 +12,14 @@
1212
pub mod specialization_graph;
1313

1414
use crate::infer::{InferCtxt, InferOk};
15-
use crate::lint;
1615
use crate::traits::select::IntercrateAmbiguityCause;
1716
use crate::traits::{self, coherence, FutureCompatOverlapErrorKind, ObligationCause, TraitEngine};
1817
use crate::ty::subst::{InternalSubsts, Subst, SubstsRef};
1918
use crate::ty::{self, TyCtxt, TypeFoldable};
2019
use rustc_data_structures::fx::FxHashSet;
2120
use rustc_errors::struct_span_err;
2221
use rustc_hir::def_id::DefId;
22+
use rustc_session::lint::builtin::ORDER_DEPENDENT_TRAIT_OBJECTS;
2323
use rustc_span::DUMMY_SP;
2424

2525
use super::util::impl_trait_ref_and_oblig;
@@ -342,7 +342,7 @@ pub(super) fn specialization_graph_provider(
342342
unreachable!("converted to hard error above")
343343
}
344344
FutureCompatOverlapErrorKind::Issue33140 => {
345-
lint::builtin::ORDER_DEPENDENT_TRAIT_OBJECTS
345+
ORDER_DEPENDENT_TRAIT_OBJECTS
346346
}
347347
};
348348
tcx.struct_span_lint_hir(

src/librustc/ty/context.rs

Lines changed: 16 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@ use crate::hir::map as hir_map;
88
use crate::hir::map::DefPathHash;
99
use crate::ich::{NodeIdHashingMode, StableHashingContext};
1010
use crate::infer::canonical::{Canonical, CanonicalVarInfo, CanonicalVarInfos};
11-
use crate::lint::{self, Lint};
11+
use crate::lint::{maybe_lint_level_root, struct_lint_level, LintSource, LintStore};
1212
use crate::middle;
1313
use crate::middle::cstore::CrateStoreDyn;
1414
use crate::middle::cstore::EncodedMetadata;
@@ -61,6 +61,7 @@ use rustc_data_structures::sync::{Lock, Lrc, WorkerLocal};
6161
use rustc_errors::DiagnosticBuilder;
6262
use rustc_index::vec::{Idx, IndexVec};
6363
use rustc_macros::HashStable;
64+
use rustc_session::lint::{Level, Lint};
6465
use rustc_session::node_id::NodeMap;
6566
use rustc_span::source_map::MultiSpan;
6667
use rustc_span::symbol::{kw, sym, Symbol};
@@ -946,7 +947,7 @@ pub struct GlobalCtxt<'tcx> {
946947

947948
pub sess: &'tcx Session,
948949

949-
pub lint_store: Lrc<lint::LintStore>,
950+
pub lint_store: Lrc<LintStore>,
950951

951952
pub dep_graph: DepGraph,
952953

@@ -1115,7 +1116,7 @@ impl<'tcx> TyCtxt<'tcx> {
11151116
/// reference to the context, to allow formatting values that need it.
11161117
pub fn create_global_ctxt(
11171118
s: &'tcx Session,
1118-
lint_store: Lrc<lint::LintStore>,
1119+
lint_store: Lrc<LintStore>,
11191120
local_providers: ty::query::Providers<'tcx>,
11201121
extern_providers: ty::query::Providers<'tcx>,
11211122
arenas: &'tcx AllArenas,
@@ -2551,21 +2552,21 @@ impl<'tcx> TyCtxt<'tcx> {
25512552
iter.intern_with(|xs| self.intern_goals(xs))
25522553
}
25532554

2554-
pub fn lint_hir<S: Into<MultiSpan>>(
2555+
pub fn lint_hir(
25552556
self,
25562557
lint: &'static Lint,
25572558
hir_id: HirId,
2558-
span: S,
2559+
span: impl Into<MultiSpan>,
25592560
msg: &str,
25602561
) {
25612562
self.struct_span_lint_hir(lint, hir_id, span.into(), msg).emit()
25622563
}
25632564

2564-
pub fn lint_hir_note<S: Into<MultiSpan>>(
2565+
pub fn lint_hir_note(
25652566
self,
25662567
lint: &'static Lint,
25672568
hir_id: HirId,
2568-
span: S,
2569+
span: impl Into<MultiSpan>,
25692570
msg: &str,
25702571
note: &str,
25712572
) {
@@ -2574,11 +2575,11 @@ impl<'tcx> TyCtxt<'tcx> {
25742575
err.emit()
25752576
}
25762577

2577-
pub fn lint_node_note<S: Into<MultiSpan>>(
2578+
pub fn lint_node_note(
25782579
self,
25792580
lint: &'static Lint,
25802581
id: hir::HirId,
2581-
span: S,
2582+
span: impl Into<MultiSpan>,
25822583
msg: &str,
25832584
note: &str,
25842585
) {
@@ -2598,7 +2599,7 @@ impl<'tcx> TyCtxt<'tcx> {
25982599
if id == bound {
25992600
return bound;
26002601
}
2601-
if lint::maybe_lint_level_root(self, id) {
2602+
if maybe_lint_level_root(self, id) {
26022603
return id;
26032604
}
26042605
let next = self.hir().get_parent_node(id);
@@ -2613,7 +2614,7 @@ impl<'tcx> TyCtxt<'tcx> {
26132614
self,
26142615
lint: &'static Lint,
26152616
mut id: hir::HirId,
2616-
) -> (lint::Level, lint::LintSource) {
2617+
) -> (Level, LintSource) {
26172618
let sets = self.lint_levels(LOCAL_CRATE);
26182619
loop {
26192620
if let Some(pair) = sets.level_and_source(lint, id, self.sess) {
@@ -2627,15 +2628,15 @@ impl<'tcx> TyCtxt<'tcx> {
26272628
}
26282629
}
26292630

2630-
pub fn struct_span_lint_hir<S: Into<MultiSpan>>(
2631+
pub fn struct_span_lint_hir(
26312632
self,
26322633
lint: &'static Lint,
26332634
hir_id: HirId,
2634-
span: S,
2635+
span: impl Into<MultiSpan>,
26352636
msg: &str,
26362637
) -> DiagnosticBuilder<'tcx> {
26372638
let (level, src) = self.lint_level_at_node(lint, hir_id);
2638-
lint::struct_lint_level(self.sess, lint, level, src, Some(span.into()), msg)
2639+
struct_lint_level(self.sess, lint, level, src, Some(span.into()), msg)
26392640
}
26402641

26412642
pub fn struct_lint_node(
@@ -2645,7 +2646,7 @@ impl<'tcx> TyCtxt<'tcx> {
26452646
msg: &str,
26462647
) -> DiagnosticBuilder<'tcx> {
26472648
let (level, src) = self.lint_level_at_node(lint, id);
2648-
lint::struct_lint_level(self.sess, lint, level, src, None, msg)
2649+
struct_lint_level(self.sess, lint, level, src, None, msg)
26492650
}
26502651

26512652
pub fn in_scope_traits(self, id: HirId) -> Option<&'tcx StableVec<TraitCandidate>> {

src/librustc/ty/query/mod.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
use crate::dep_graph::{self, DepNode};
22
use crate::hir::exports::Export;
33
use crate::infer::canonical::{self, Canonical};
4-
use crate::lint;
4+
use crate::lint::LintLevelMap;
55
use crate::middle::codegen_fn_attrs::CodegenFnAttrs;
66
use crate::middle::cstore::{CrateSource, DepKind, NativeLibraryKind};
77
use crate::middle::cstore::{ExternCrate, ForeignModule, LinkagePreference, NativeLibrary};

src/librustc_ast_passes/Cargo.toml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@ path = "lib.rs"
1111
[dependencies]
1212
log = "0.4"
1313
rustc_data_structures = { path = "../librustc_data_structures" }
14-
rustc_errors = { path = "../librustc_errors", package = "rustc_errors" }
14+
rustc_errors = { path = "../librustc_errors" }
1515
rustc_error_codes = { path = "../librustc_error_codes" }
1616
rustc_feature = { path = "../librustc_feature" }
1717
rustc_parse = { path = "../librustc_parse" }

0 commit comments

Comments
 (0)