diff options
| author | Guillaume Gomez <guillaume1.gomez@gmail.com> | 2018-09-18 10:21:41 +0200 |
|---|---|---|
| committer | GitHub <noreply@github.com> | 2018-09-18 10:21:41 +0200 |
| commit | 50b9694af9739d5a4273c1928b41ee23ff59b3c7 (patch) | |
| tree | e33fbb9887808a8e0b6a812af56392b73c04e640 /src/libsyntax | |
| parent | 5f1a123c2018e65e54dfbea5702cea026b1202d6 (diff) | |
| parent | 79da7a0a2f3c5490e1b8a4233795424bcf05520a (diff) | |
| download | rust-50b9694af9739d5a4273c1928b41ee23ff59b3c7.tar.gz rust-50b9694af9739d5a4273c1928b41ee23ff59b3c7.zip | |
Rollup merge of #54299 - snaedis:issue-54246, r=varkor
Issue 54246 I added the option of providing a help message for deprecated features, that takes precedence over the default `help: remove this attribute` message, along with messages for the features that mention replacements in the reason for deprecation. Fixes #54246.
Diffstat (limited to 'src/libsyntax')
| -rw-r--r-- | src/libsyntax/feature_gate.rs | 17 |
1 files changed, 10 insertions, 7 deletions
diff --git a/src/libsyntax/feature_gate.rs b/src/libsyntax/feature_gate.rs index 060faa9856d..67a9601fb12 100644 --- a/src/libsyntax/feature_gate.rs +++ b/src/libsyntax/feature_gate.rs @@ -711,7 +711,7 @@ pub enum AttributeGate { impl AttributeGate { fn is_deprecated(&self) -> bool { match *self { - Gated(Stability::Deprecated(_), ..) => true, + Gated(Stability::Deprecated(_, _), ..) => true, _ => false, } } @@ -720,8 +720,9 @@ impl AttributeGate { #[derive(Copy, Clone, Debug)] pub enum Stability { Unstable, - // Argument is tracking issue link. - Deprecated(&'static str), + // First argument is tracking issue link; second argument is an optional + // help message, which defaults to "remove this attribute" + Deprecated(&'static str, Option<&'static str>), } // fn() is not Debug @@ -1048,7 +1049,7 @@ pub const BUILTIN_ATTRIBUTES: &'static [(&'static str, AttributeType, AttributeG ("no_builtins", Whitelisted, Ungated), ("no_mangle", Whitelisted, Ungated), ("no_debug", Whitelisted, Gated( - Stability::Deprecated("https://github.com/rust-lang/rust/issues/29721"), + Stability::Deprecated("https://github.com/rust-lang/rust/issues/29721", None), "no_debug", "the `#[no_debug]` attribute was an experimental feature that has been \ deprecated due to lack of demand", @@ -1061,7 +1062,8 @@ pub const BUILTIN_ATTRIBUTES: &'static [(&'static str, AttributeType, AttributeG cfg_fn!(omit_gdb_pretty_printer_section))), ("unsafe_destructor_blind_to_params", Normal, - Gated(Stability::Deprecated("https://github.com/rust-lang/rust/issues/34761"), + Gated(Stability::Deprecated("https://github.com/rust-lang/rust/issues/34761", + Some("replace this attribute with `#[may_dangle]`")), "dropck_parametricity", "unsafe_destructor_blind_to_params has been replaced by \ may_dangle and will be removed in the future", @@ -1140,9 +1142,10 @@ pub const BUILTIN_ATTRIBUTES: &'static [(&'static str, AttributeType, AttributeG ("panic_implementation", Normal, Gated(Stability::Deprecated("https://github.com/rust-lang/rust/issues/44489\ - #issuecomment-415140224"), + #issuecomment-415140224", + Some("replace this attribute with `#[panic_handler]`")), "panic_implementation", - "This attribute was renamed to `panic_handler`", + "this attribute was renamed to `panic_handler`", cfg_fn!(panic_implementation))), // RFC 2070 |
