File tree Expand file tree Collapse file tree 1 file changed +9
-0
lines changed
compiler/rustc_attr_parsing/src/attributes Expand file tree Collapse file tree 1 file changed +9
-0
lines changed Original file line number Diff line number Diff line change @@ -51,6 +51,9 @@ type AcceptMapping<T> = &'static [(&'static [Symbol], AcceptFn<T>)];
51
51
/// whether it has seen the attribute it has been looking for.
52
52
///
53
53
/// The state machine is automatically reset to parse attributes on the next item.
54
+ ///
55
+ /// For a simpler attribute parsing interface, consider using [`SingleAttributeParser`]
56
+ /// or [`CombineAttributeParser`] instead.
54
57
pub ( crate ) trait AttributeParser : Default + ' static {
55
58
/// The symbols for the attributes that this parser is interested in.
56
59
///
@@ -59,6 +62,12 @@ pub(crate) trait AttributeParser: Default + 'static {
59
62
60
63
/// The parser has gotten a chance to accept the attributes on an item,
61
64
/// here it can produce an attribute.
65
+ ///
66
+ /// All finalize methods of all parsers are unconditionally called.
67
+ /// This means you can't unconditionally return `Some` here,
68
+ /// that'd be equivalent to unconditionally applying an attribute to
69
+ /// every single syntax item that could have attributes applied to it.
70
+ /// Your accept mappings should determine whether this returns something.
62
71
fn finalize ( self , cx : & FinalizeContext < ' _ > ) -> Option < AttributeKind > ;
63
72
}
64
73
You can’t perform that action at this time.
0 commit comments