1
1
use super :: prelude:: * ;
2
2
3
+ const PROC_MACRO_ALLOWED_TARGETS : AllowedTargets =
4
+ AllowedTargets :: AllowList ( & [ Allow ( Target :: Fn ) , Warn ( Target :: Crate ) , Warn ( Target :: MacroCall ) ] ) ;
5
+
3
6
pub ( crate ) struct ProcMacroParser ;
4
7
impl < S : Stage > NoArgsAttributeParser < S > for ProcMacroParser {
5
8
const PATH : & [ Symbol ] = & [ sym:: proc_macro] ;
6
9
const ON_DUPLICATE : OnDuplicate < S > = OnDuplicate :: Error ;
7
- const ALLOWED_TARGETS : AllowedTargets =
8
- AllowedTargets :: AllowList ( & [ Allow ( Target :: Fn ) , Warn ( Target :: Crate ) ] ) ;
10
+ const ALLOWED_TARGETS : AllowedTargets = PROC_MACRO_ALLOWED_TARGETS ;
9
11
const CREATE : fn ( Span ) -> AttributeKind = AttributeKind :: ProcMacro ;
10
12
}
11
13
12
14
pub ( crate ) struct ProcMacroAttributeParser ;
13
15
impl < S : Stage > NoArgsAttributeParser < S > for ProcMacroAttributeParser {
14
16
const PATH : & [ Symbol ] = & [ sym:: proc_macro_attribute] ;
15
17
const ON_DUPLICATE : OnDuplicate < S > = OnDuplicate :: Error ;
16
- const ALLOWED_TARGETS : AllowedTargets =
17
- AllowedTargets :: AllowList ( & [ Allow ( Target :: Fn ) , Warn ( Target :: Crate ) ] ) ;
18
+ const ALLOWED_TARGETS : AllowedTargets = PROC_MACRO_ALLOWED_TARGETS ;
18
19
const CREATE : fn ( Span ) -> AttributeKind = AttributeKind :: ProcMacroAttribute ;
19
20
}
20
21
@@ -23,8 +24,7 @@ impl<S: Stage> SingleAttributeParser<S> for ProcMacroDeriveParser {
23
24
const PATH : & [ Symbol ] = & [ sym:: proc_macro_derive] ;
24
25
const ATTRIBUTE_ORDER : AttributeOrder = AttributeOrder :: KeepOutermost ;
25
26
const ON_DUPLICATE : OnDuplicate < S > = OnDuplicate :: Error ;
26
- const ALLOWED_TARGETS : AllowedTargets =
27
- AllowedTargets :: AllowList ( & [ Allow ( Target :: Fn ) , Warn ( Target :: Crate ) ] ) ;
27
+ const ALLOWED_TARGETS : AllowedTargets = PROC_MACRO_ALLOWED_TARGETS ;
28
28
const TEMPLATE : AttributeTemplate = template ! (
29
29
List : & [ "TraitName" , "TraitName, attributes(name1, name2, ...)" ] ,
30
30
"https://doc.rust-lang.org/reference/procedural-macros.html#derive-macros"
0 commit comments