From 88e4def9c74bbb3d8c68f16c87ee38a55b5379f5 Mon Sep 17 00:00:00 2001 From: Mohit Agarwal Date: Thu, 25 Aug 2016 19:09:48 +0530 Subject: [PATCH] Update E0453 to new error format Fixes #35929. Part of #35233. r? @jonathandturner --- src/librustc/lint/context.rs | 5 +++-- src/test/compile-fail-fulldeps/lint-plugin-forbid-attrs.rs | 6 ++++-- src/test/compile-fail/E0453.rs | 5 ++++- src/test/compile-fail/lint-forbid-attr.rs | 6 ++++-- 4 files changed, 15 insertions(+), 7 deletions(-) diff --git a/src/librustc/lint/context.rs b/src/librustc/lint/context.rs index daac315e14d..9c06f0cca15 100644 --- a/src/librustc/lint/context.rs +++ b/src/librustc/lint/context.rs @@ -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") diff --git a/src/test/compile-fail-fulldeps/lint-plugin-forbid-attrs.rs b/src/test/compile-fail-fulldeps/lint-plugin-forbid-attrs.rs index 61a8ee88a70..75a025f0648 100644 --- a/src/test/compile-fail-fulldeps/lint-plugin-forbid-attrs.rs +++ b/src/test/compile-fail-fulldeps/lint-plugin-forbid-attrs.rs @@ -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(); } diff --git a/src/test/compile-fail/E0453.rs b/src/test/compile-fail/E0453.rs index 629b373cd7f..6fed3dca94e 100644 --- a/src/test/compile-fail/E0453.rs +++ b/src/test/compile-fail/E0453.rs @@ -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() { } diff --git a/src/test/compile-fail/lint-forbid-attr.rs b/src/test/compile-fail/lint-forbid-attr.rs index fd2513c5a06..a23083b5c8c 100644 --- a/src/test/compile-fail/lint-forbid-attr.rs +++ b/src/test/compile-fail/lint-forbid-attr.rs @@ -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() { }