mirror of
https://github.com/rust-lang/rust
synced 2024-09-18 16:02:39 +00:00
Deprecate custom_derive
Has a custom deprecation since deprecating features is not supported and is a pain to implement
This commit is contained in:
parent
d1b08b136c
commit
b7675cf04a
|
@ -897,7 +897,12 @@ pub fn feature_err<'a>(sess: &'a ParseSess, feature: &str, span: Span, issue: Ga
|
||||||
"allow_internal_unstable side-steps feature gating and stability checks";
|
"allow_internal_unstable side-steps feature gating and stability checks";
|
||||||
|
|
||||||
pub const EXPLAIN_CUSTOM_DERIVE: &'static str =
|
pub const EXPLAIN_CUSTOM_DERIVE: &'static str =
|
||||||
"`#[derive]` for custom traits is not stable enough for use and is subject to change";
|
"`#[derive]` for custom traits is not stable enough for use. It is deprecated and will \
|
||||||
|
be removed in v1.15";
|
||||||
|
|
||||||
|
pub const EXPLAIN_DEPR_CUSTOM_DERIVE: &'static str =
|
||||||
|
"`#[derive]` for custom traits is deprecated and will be removed in v1.15. Prefer using \
|
||||||
|
procedural macro custom derive";
|
||||||
|
|
||||||
pub const EXPLAIN_DERIVE_UNDERSCORE: &'static str =
|
pub const EXPLAIN_DERIVE_UNDERSCORE: &'static str =
|
||||||
"attributes of the form `#[derive_*]` are reserved for the compiler";
|
"attributes of the form `#[derive_*]` are reserved for the compiler";
|
||||||
|
|
|
@ -175,6 +175,7 @@ pub fn expand_derive(cx: &mut ExtCtxt,
|
||||||
feature_gate::GateIssue::Language,
|
feature_gate::GateIssue::Language,
|
||||||
feature_gate::EXPLAIN_CUSTOM_DERIVE);
|
feature_gate::EXPLAIN_CUSTOM_DERIVE);
|
||||||
} else {
|
} else {
|
||||||
|
cx.span_warn(titem.span, EXPLAIN_DEPR_CUSTOM_DERIVE);
|
||||||
let name = intern_and_get_ident(&format!("derive_{}", tname));
|
let name = intern_and_get_ident(&format!("derive_{}", tname));
|
||||||
let mitem = cx.meta_word(titem.span, name);
|
let mitem = cx.meta_word(titem.span, name);
|
||||||
new_attributes.push(cx.attribute(mitem.span, mitem));
|
new_attributes.push(cx.attribute(mitem.span, mitem));
|
||||||
|
|
Loading…
Reference in a new issue