diff options
| author | Vadim Petrochenkov <vadim.petrochenkov@gmail.com> | 2019-06-23 14:59:42 +0300 |
|---|---|---|
| committer | Vadim Petrochenkov <vadim.petrochenkov@gmail.com> | 2019-07-07 13:04:07 +0300 |
| commit | b6d522a101982b4c6919391a378e799bd74a4da6 (patch) | |
| tree | 404fe3b4f4c5c2ececec0aee30bffd6296009837 /src/libsyntax_ext/deriving | |
| parent | 1ee0ce82cba66305f03725fb73ad381349a9b8e4 (diff) | |
| download | rust-b6d522a101982b4c6919391a378e799bd74a4da6.tar.gz rust-b6d522a101982b4c6919391a378e799bd74a4da6.zip | |
syntax: Pre-intern names of all built-in macros
They always end up interned anyway
Diffstat (limited to 'src/libsyntax_ext/deriving')
| -rw-r--r-- | src/libsyntax_ext/deriving/mod.rs | 34 |
1 files changed, 17 insertions, 17 deletions
diff --git a/src/libsyntax_ext/deriving/mod.rs b/src/libsyntax_ext/deriving/mod.rs index f7889b9cac0..e491e93256d 100644 --- a/src/libsyntax_ext/deriving/mod.rs +++ b/src/libsyntax_ext/deriving/mod.rs @@ -61,10 +61,10 @@ impl MultiItemModifier for BuiltinDerive { } macro_rules! derive_traits { - ($( [$deprecation:expr] $name:expr => $func:path, )+) => { + ($( [$deprecation:expr] $name:ident => $func:path, )+) => { pub fn is_builtin_trait(name: ast::Name) -> bool { - match &*name.as_str() { - $( $name )|+ => true, + match name { + $( sym::$name )|+ => true, _ => false, } } @@ -80,7 +80,7 @@ macro_rules! derive_traits { $( resolver.add_builtin( - ast::Ident::with_empty_ctxt(Symbol::intern($name)), + ast::Ident::with_empty_ctxt(sym::$name), Lrc::new(SyntaxExtension { deprecation: $deprecation.map(|msg| Deprecation { since: Some(Symbol::intern("1.0.0")), @@ -100,40 +100,40 @@ macro_rules! derive_traits { derive_traits! { [None] - "Clone" => clone::expand_deriving_clone, + Clone => clone::expand_deriving_clone, [None] - "Hash" => hash::expand_deriving_hash, + Hash => hash::expand_deriving_hash, [None] - "RustcEncodable" => encodable::expand_deriving_rustc_encodable, + RustcEncodable => encodable::expand_deriving_rustc_encodable, [None] - "RustcDecodable" => decodable::expand_deriving_rustc_decodable, + RustcDecodable => decodable::expand_deriving_rustc_decodable, [None] - "PartialEq" => partial_eq::expand_deriving_partial_eq, + PartialEq => partial_eq::expand_deriving_partial_eq, [None] - "Eq" => eq::expand_deriving_eq, + Eq => eq::expand_deriving_eq, [None] - "PartialOrd" => partial_ord::expand_deriving_partial_ord, + PartialOrd => partial_ord::expand_deriving_partial_ord, [None] - "Ord" => ord::expand_deriving_ord, + Ord => ord::expand_deriving_ord, [None] - "Debug" => debug::expand_deriving_debug, + Debug => debug::expand_deriving_debug, [None] - "Default" => default::expand_deriving_default, + Default => default::expand_deriving_default, [None] - "Copy" => bounds::expand_deriving_copy, + Copy => bounds::expand_deriving_copy, // deprecated [Some("derive(Encodable) is deprecated in favor of derive(RustcEncodable)")] - "Encodable" => encodable::expand_deriving_encodable, + Encodable => encodable::expand_deriving_encodable, [Some("derive(Decodable) is deprecated in favor of derive(RustcDecodable)")] - "Decodable" => decodable::expand_deriving_decodable, + Decodable => decodable::expand_deriving_decodable, } /// Construct a name for the inner type parameter that can't collide with any type parameters of |
