diff options
| author | Zack M. Davis <code@zackmdavis.net> | 2017-09-29 23:44:41 -0700 |
|---|---|---|
| committer | Zack M. Davis <code@zackmdavis.net> | 2017-09-30 11:31:12 -0700 |
| commit | f2c5acd611e383020db373f0b2dd7d4a89ed33c0 (patch) | |
| tree | a906226943fb86e9943ff6aa352a28d4a5923d39 | |
| parent | d663003e034a50be8aa62f394d03ad594fcf2b3c (diff) | |
| download | rust-f2c5acd611e383020db373f0b2dd7d4a89ed33c0.tar.gz rust-f2c5acd611e383020db373f0b2dd7d4a89ed33c0.zip | |
code suggestion for deprecated-attribute lint
Also, fix the deprecation message for the late no-debug feature.
| -rw-r--r-- | src/librustc_lint/builtin.rs | 9 | ||||
| -rw-r--r-- | src/libsyntax/feature_gate.rs | 3 | ||||
| -rw-r--r-- | src/test/compile-fail/feature-gate-no-debug.rs | 2 |
3 files changed, 8 insertions, 6 deletions
diff --git a/src/librustc_lint/builtin.rs b/src/librustc_lint/builtin.rs index f3bf37c11a5..cedc2871623 100644 --- a/src/librustc_lint/builtin.rs +++ b/src/librustc_lint/builtin.rs @@ -650,10 +650,11 @@ impl EarlyLintPass for DeprecatedAttr { ref name, ref reason, _) = g { - cx.span_lint(DEPRECATED, - attr.span, - &format!("use of deprecated attribute `{}`: {}. See {}", - name, reason, link)); + let msg = format!("use of deprecated attribute `{}`: {}. See {}", + name, reason, link); + let mut err = cx.struct_span_lint(DEPRECATED, attr.span, &msg); + err.span_suggestion_short(attr.span, "remove this attribute", "".to_owned()); + err.emit(); } return; } diff --git a/src/libsyntax/feature_gate.rs b/src/libsyntax/feature_gate.rs index e92a7484f33..f6e85ed6725 100644 --- a/src/libsyntax/feature_gate.rs +++ b/src/libsyntax/feature_gate.rs @@ -824,7 +824,8 @@ pub const BUILTIN_ATTRIBUTES: &'static [(&'static str, AttributeType, AttributeG ("no_debug", Whitelisted, Gated( Stability::Deprecated("https://github.com/rust-lang/rust/issues/29721"), "no_debug", - "the `#[no_debug]` attribute is an experimental feature", + "the `#[no_debug]` attribute was an experimental feature that has been \ + deprecated due to lack of demand", cfg_fn!(no_debug))), ("omit_gdb_pretty_printer_section", Whitelisted, Gated(Stability::Unstable, "omit_gdb_pretty_printer_section", diff --git a/src/test/compile-fail/feature-gate-no-debug.rs b/src/test/compile-fail/feature-gate-no-debug.rs index 9815db6550d..d21493de50a 100644 --- a/src/test/compile-fail/feature-gate-no-debug.rs +++ b/src/test/compile-fail/feature-gate-no-debug.rs @@ -10,5 +10,5 @@ #![allow(deprecated)] -#[no_debug] //~ ERROR the `#[no_debug]` attribute is +#[no_debug] //~ ERROR the `#[no_debug]` attribute was fn main() {} |
