Make #[derive(Anything)] into sugar for #[derive_Anything]
This is a hack, but I don't think we can do much better as long as `derive` is
running at the syntax expansion phase.
If the custom_derive feature gate is enabled, this works with user-defined
traits and syntax extensions. Without the gate, you can't use e.g. #[derive_Clone]
directly, so this does not change the stable language.
This commit also cleans up the deriving code somewhat, and forbids some
previously-meaningless attribute syntax. For this reason it's technically a
[breaking-change]
This commit is contained in:
@@ -491,10 +491,8 @@ fn initial_syntax_expander_table<'feat>(ecfg: &expand::ExpansionConfig<'feat>)
|
||||
syntax_expanders.insert(intern("log_syntax"),
|
||||
builtin_normal_expander(
|
||||
ext::log_syntax::expand_syntax_ext));
|
||||
syntax_expanders.insert(intern("derive"),
|
||||
Decorator(Box::new(ext::deriving::expand_meta_derive)));
|
||||
syntax_expanders.insert(intern("deriving"),
|
||||
Decorator(Box::new(ext::deriving::expand_deprecated_deriving)));
|
||||
|
||||
ext::deriving::register_all(&mut syntax_expanders);
|
||||
|
||||
if ecfg.enable_quotes() {
|
||||
// Quasi-quoting expanders
|
||||
|
||||
Reference in New Issue
Block a user