Skip to content

Commit b7675cf

Browse files
committed
Deprecate custom_derive
Has a custom deprecation since deprecating features is not supported and is a pain to implement
1 parent d1b08b1 commit b7675cf

File tree

2 files changed

+7
-1
lines changed

2 files changed

+7
-1
lines changed

src/libsyntax/feature_gate.rs

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -897,7 +897,12 @@ pub const EXPLAIN_ALLOW_INTERNAL_UNSTABLE: &'static str =
897897
"allow_internal_unstable side-steps feature gating and stability checks";
898898

899899
pub const EXPLAIN_CUSTOM_DERIVE: &'static str =
900-
"`#[derive]` for custom traits is not stable enough for use and is subject to change";
900+
"`#[derive]` for custom traits is not stable enough for use. It is deprecated and will \
901+
be removed in v1.15";
902+
903+
pub const EXPLAIN_DEPR_CUSTOM_DERIVE: &'static str =
904+
"`#[derive]` for custom traits is deprecated and will be removed in v1.15. Prefer using \
905+
procedural macro custom derive";
901906

902907
pub const EXPLAIN_DERIVE_UNDERSCORE: &'static str =
903908
"attributes of the form `#[derive_*]` are reserved for the compiler";

src/libsyntax_ext/deriving/mod.rs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -175,6 +175,7 @@ pub fn expand_derive(cx: &mut ExtCtxt,
175175
feature_gate::GateIssue::Language,
176176
feature_gate::EXPLAIN_CUSTOM_DERIVE);
177177
} else {
178+
cx.span_warn(titem.span, EXPLAIN_DEPR_CUSTOM_DERIVE);
178179
let name = intern_and_get_ident(&format!("derive_{}", tname));
179180
let mitem = cx.meta_word(titem.span, name);
180181
new_attributes.push(cx.attribute(mitem.span, mitem));

0 commit comments

Comments
 (0)