Skip to content

Commit f2c5acd

Browse files
committed
code suggestion for deprecated-attribute lint
Also, fix the deprecation message for the late no-debug feature.
1 parent d663003 commit f2c5acd

File tree

3 files changed

+8
-6
lines changed

3 files changed

+8
-6
lines changed

src/librustc_lint/builtin.rs

+5-4
Original file line numberDiff line numberDiff line change
@@ -650,10 +650,11 @@ impl EarlyLintPass for DeprecatedAttr {
650650
ref name,
651651
ref reason,
652652
_) = g {
653-
cx.span_lint(DEPRECATED,
654-
attr.span,
655-
&format!("use of deprecated attribute `{}`: {}. See {}",
656-
name, reason, link));
653+
let msg = format!("use of deprecated attribute `{}`: {}. See {}",
654+
name, reason, link);
655+
let mut err = cx.struct_span_lint(DEPRECATED, attr.span, &msg);
656+
err.span_suggestion_short(attr.span, "remove this attribute", "".to_owned());
657+
err.emit();
657658
}
658659
return;
659660
}

src/libsyntax/feature_gate.rs

+2-1
Original file line numberDiff line numberDiff line change
@@ -824,7 +824,8 @@ pub const BUILTIN_ATTRIBUTES: &'static [(&'static str, AttributeType, AttributeG
824824
("no_debug", Whitelisted, Gated(
825825
Stability::Deprecated("https://github.com/rust-lang/rust/issues/29721"),
826826
"no_debug",
827-
"the `#[no_debug]` attribute is an experimental feature",
827+
"the `#[no_debug]` attribute was an experimental feature that has been \
828+
deprecated due to lack of demand",
828829
cfg_fn!(no_debug))),
829830
("omit_gdb_pretty_printer_section", Whitelisted, Gated(Stability::Unstable,
830831
"omit_gdb_pretty_printer_section",

src/test/compile-fail/feature-gate-no-debug.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -10,5 +10,5 @@
1010

1111
#![allow(deprecated)]
1212

13-
#[no_debug] //~ ERROR the `#[no_debug]` attribute is
13+
#[no_debug] //~ ERROR the `#[no_debug]` attribute was
1414
fn main() {}

0 commit comments

Comments
 (0)