From e4871c4b6ff66296219ff4d07f65e9a59eb4220c 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/E0453.rs | 5 ++++- src/test/compile-fail/lint-forbid-attr.rs | 6 ++++-- 3 files changed, 11 insertions(+), 5 deletions(-) diff --git a/src/librustc/lint/context.rs b/src/librustc/lint/context.rs index daac315e14def..9c06f0cca1566 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/E0453.rs b/src/test/compile-fail/E0453.rs index 629b373cd7f12..6fed3dca94ef1 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 fd2513c5a066d..a23083b5c8c11 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() { }