diff --git a/src/librustc/driver/session.rs b/src/librustc/driver/session.rs index c7b336de091..3fdf4126c15 100644 --- a/src/librustc/driver/session.rs +++ b/src/librustc/driver/session.rs @@ -234,6 +234,7 @@ pub impl Session_ { msg: &str) { let level = lint::get_lint_settings_level( self.lint_settings, lint_mode, expr_id, item_id); + let msg = fmt!("%s [-W%s]", msg, lint::get_lint_name(lint_mode)); self.span_lint_level(level, span, msg); } fn next_node_id(@self) -> ast::node_id { diff --git a/src/librustc/middle/lint.rs b/src/librustc/middle/lint.rs index 59b7a5ff111..6494ac0f9e8 100644 --- a/src/librustc/middle/lint.rs +++ b/src/librustc/middle/lint.rs @@ -245,6 +245,14 @@ pub fn get_lint_dict() -> LintDict { return @map; } +pub fn get_lint_name(lint_mode: lint) -> ~str { + for lint_table.each |&(name, spec)| { + if spec.lint == lint_mode { + return name.to_str(); + } + } + fail!(); +} // This is a highly not-optimal set of data structure decisions. type LintModes = @mut SmallIntMap; type LintModeMap = @mut HashMap;