Skip to content

Commit 7a4c6e5

Browse files
committed
auto merge of #6325 : sammykim/rust/lint-name, r=graydon
Fix #3525.
2 parents 4757a58 + 1b4e375 commit 7a4c6e5

File tree

2 files changed

+9
-0
lines changed

2 files changed

+9
-0
lines changed

src/librustc/driver/session.rs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -237,6 +237,7 @@ pub impl Session_ {
237237
msg: &str) {
238238
let level = lint::get_lint_settings_level(
239239
self.lint_settings, lint_mode, expr_id, item_id);
240+
let msg = fmt!("%s [-W %s]", msg, lint::get_lint_name(lint_mode));
240241
self.span_lint_level(level, span, msg);
241242
}
242243
fn next_node_id(@self) -> ast::node_id {

src/librustc/middle/lint.rs

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -237,6 +237,14 @@ pub fn get_lint_dict() -> LintDict {
237237
return @map;
238238
}
239239

240+
pub fn get_lint_name(lint_mode: lint) -> ~str {
241+
for lint_table.each |&(name, spec)| {
242+
if spec.lint == lint_mode {
243+
return name.to_str();
244+
}
245+
}
246+
fail!();
247+
}
240248
// This is a highly not-optimal set of data structure decisions.
241249
type LintModes = @mut SmallIntMap<level>;
242250
type LintModeMap = @mut HashMap<ast::node_id, LintModes>;

0 commit comments

Comments
 (0)