Skip to content

Commit d8467e2

Browse files
committed
rustc: abstract lint level exporting from EnumSizeVariance
1 parent c327080 commit d8467e2

File tree

2 files changed

+9
-8
lines changed

2 files changed

+9
-8
lines changed

src/librustc/middle/lint.rs

+6-6
Original file line numberDiff line numberDiff line change
@@ -72,7 +72,7 @@ use syntax::parse::token;
7272
use syntax::visit::Visitor;
7373
use syntax::{ast, ast_util, visit};
7474

75-
#[deriving(Clone, Show, Eq, Ord, TotalEq, TotalOrd)]
75+
#[deriving(Clone, Show, Eq, Ord, TotalEq, TotalOrd, Hash)]
7676
pub enum Lint {
7777
CTypes,
7878
UnusedImports,
@@ -471,9 +471,9 @@ struct Context<'a> {
471471
/// Ids of structs/enums which have been checked for raw_pointer_deriving
472472
checked_raw_pointers: NodeSet,
473473

474-
/// Level of EnumSizeVariance lint for each enum, stored here because the
475-
/// body of the lint needs to run in trans.
476-
enum_levels: HashMap<ast::NodeId, (Level, LintSource)>,
474+
/// Level of lints for certain NodeIds, stored here because the body of
475+
/// the lint needs to run in trans.
476+
node_levels: HashMap<(ast::NodeId, Lint), (Level, LintSource)>,
477477
}
478478

479479
pub fn emit_lint(level: Level, src: LintSource, msg: &str, span: Span,
@@ -1921,7 +1921,7 @@ pub fn check_crate(tcx: &ty::ctxt,
19211921
lint_stack: Vec::new(),
19221922
negated_expr_id: -1,
19231923
checked_raw_pointers: NodeSet::new(),
1924-
enum_levels: HashMap::new(),
1924+
node_levels: HashMap::new(),
19251925
};
19261926

19271927
// Install default lint levels, followed by the command line levels, and
@@ -1963,5 +1963,5 @@ pub fn check_crate(tcx: &ty::ctxt,
19631963
}
19641964

19651965
tcx.sess.abort_if_errors();
1966-
*tcx.enum_lint_levels.borrow_mut() = cx.enum_levels;
1966+
*tcx.node_lint_levels.borrow_mut() = cx.node_levels;
19671967
}

src/librustc/middle/ty.rs

+3-2
Original file line numberDiff line numberDiff line change
@@ -354,7 +354,8 @@ pub struct ctxt {
354354

355355
pub dependency_formats: RefCell<dependency_format::Dependencies>,
356356

357-
pub enum_lint_levels: RefCell<HashMap<ast::NodeId, (lint::Level, lint::LintSource)>>,
357+
pub node_lint_levels: RefCell<HashMap<(ast::NodeId, lint::Lint),
358+
(lint::Level, lint::LintSource)>>,
358359
}
359360

360361
pub enum tbox_flag {
@@ -1137,7 +1138,7 @@ pub fn mk_ctxt(s: Session,
11371138
method_map: RefCell::new(FnvHashMap::new()),
11381139
vtable_map: RefCell::new(FnvHashMap::new()),
11391140
dependency_formats: RefCell::new(HashMap::new()),
1140-
enum_lint_levels: RefCell::new(HashMap::new()),
1141+
node_lint_levels: RefCell::new(HashMap::new()),
11411142
}
11421143
}
11431144

0 commit comments

Comments
 (0)