Skip to content

Commit

Permalink
Update E0453 to new error format
Browse files Browse the repository at this point in the history
  • Loading branch information
0xmohit committed Aug 26, 2016
1 parent f5499a0 commit 88e4def
Show file tree
Hide file tree
Showing 4 changed files with 15 additions and 7 deletions.
5 changes: 3 additions & 2 deletions src/librustc/lint/context.rs
Original file line number Diff line number Diff line change
Expand Up @@ -606,11 +606,12 @@ pub trait LintContext: Sized {
"{}({}) overruled by outer forbid({})",
level.as_str(), lint_name,
lint_name);
diag_builder.span_label(span, &format!("overruled by previous forbid"));
match now_source {
LintSource::Default => &mut diag_builder,
LintSource::Node(forbid_source_span) => {
diag_builder.span_note(forbid_source_span,
"`forbid` lint level set here")
diag_builder.span_label(forbid_source_span,
&format!("`forbid` level set here"))
},
LintSource::CommandLine => {
diag_builder.note("`forbid` lint level was set on command line")
Expand Down
6 changes: 4 additions & 2 deletions src/test/compile-fail-fulldeps/lint-plugin-forbid-attrs.rs
Original file line number Diff line number Diff line change
Expand Up @@ -15,11 +15,13 @@
#![plugin(lint_plugin_test)]
#![forbid(test_lint)]
//~^ NOTE lint level defined here
//~| NOTE `forbid` lint level set here
//~| NOTE `forbid` level set here

fn lintme() { } //~ ERROR item is named 'lintme'

#[allow(test_lint)] //~ ERROR allow(test_lint) overruled by outer forbid(test_lint)
#[allow(test_lint)]
//~^ ERROR allow(test_lint) overruled by outer forbid(test_lint)
//~| NOTE overruled by previous forbid
pub fn main() {
lintme();
}
5 changes: 4 additions & 1 deletion src/test/compile-fail/E0453.rs
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,10 @@
// except according to those terms.

#![forbid(non_snake_case)]
//~^ NOTE `forbid` level set here

#[allow(non_snake_case)] //~ ERROR E0453
#[allow(non_snake_case)]
//~^ ERROR allow(non_snake_case) overruled by outer forbid(non_snake_case)
//~| NOTE overruled by previous forbid
fn main() {
}
6 changes: 4 additions & 2 deletions src/test/compile-fail/lint-forbid-attr.rs
Original file line number Diff line number Diff line change
Expand Up @@ -9,8 +9,10 @@
// except according to those terms.

#![forbid(deprecated)]
//~^ NOTE `forbid` lint level set here
//~^ NOTE `forbid` level set here

#[allow(deprecated)] //~ ERROR allow(deprecated) overruled by outer forbid(deprecated)
#[allow(deprecated)]
//~^ ERROR allow(deprecated) overruled by outer forbid(deprecated)
//~| NOTE overruled by previous forbid
fn main() {
}

0 comments on commit 88e4def

Please sign in to comment.