@@ -115,7 +115,8 @@ impl<'a> Deref for AcceptContext<'a> {
115
115
116
116
/// Context given to every attribute parser during finalization.
117
117
///
118
- /// Gives [`AttributeParser`](crate::attributes::AttributeParser)s enough information to create errors, for example.
118
+ /// Gives [`AttributeParser`](crate::attributes::AttributeParser)s enough information to create
119
+ /// errors, for example.
119
120
pub ( crate ) struct FinalizeContext < ' a > {
120
121
/// The parse context, gives access to the session and the
121
122
/// diagnostics context.
@@ -146,10 +147,9 @@ pub struct AttributeParser<'sess> {
146
147
sess : & ' sess Session ,
147
148
features : Option < & ' sess Features > ,
148
149
149
- /// *only * parse attributes with this symbol.
150
+ /// *Only * parse attributes with this symbol.
150
151
///
151
- /// Used in cases where we want the lowering infrastructure for
152
- /// parse just a single attribute.
152
+ /// Used in cases where we want the lowering infrastructure for parse just a single attribute.
153
153
parse_only : Option < Symbol > ,
154
154
155
155
/// Can be used to instruct parsers to reduce the number of diagnostics it emits.
@@ -162,9 +162,9 @@ impl<'sess> AttributeParser<'sess> {
162
162
/// One example where this is necessary, is to parse `feature` attributes themselves for
163
163
/// example.
164
164
///
165
- /// Try to use this as little as possible. Attributes *should* be lowered during `rustc_ast_lowering`.
166
- /// Some attributes require access to features to parse, which would crash if you tried to do so
167
- /// through [`parse_limited`](Self::parse_limited).
165
+ /// Try to use this as little as possible. Attributes *should* be lowered during
166
+ /// `rustc_ast_lowering`. Some attributes require access to features to parse, which would
167
+ /// crash if you tried to do so through [`parse_limited`](Self::parse_limited).
168
168
///
169
169
/// To make sure use is limited, supply a `Symbol` you'd like to parse. Only attributes with
170
170
/// that symbol are picked out of the list of instructions and parsed. Those are returned.
@@ -222,19 +222,18 @@ impl<'sess> AttributeParser<'sess> {
222
222
let group_cx = FinalizeContext { cx : self , target_span } ;
223
223
224
224
for attr in attrs {
225
- // if we're only looking for a single attribute,
226
- // skip all the ones we don't care about
225
+ // If we're only looking for a single attribute, skip all the ones we don't care about.
227
226
if let Some ( expected) = self . parse_only {
228
227
if !attr. has_name ( expected) {
229
228
continue ;
230
229
}
231
230
}
232
231
233
- // sometimes , for example for `#![doc = include_str!("readme.md")]`,
232
+ // Sometimes , for example for `#![doc = include_str!("readme.md")]`,
234
233
// doc still contains a non-literal. You might say, when we're lowering attributes
235
234
// that's expanded right? But no, sometimes, when parsing attributes on macros,
236
235
// we already use the lowering logic and these are still there. So, when `omit_doc`
237
- // is set we *also* want to ignore these
236
+ // is set we *also* want to ignore these.
238
237
if omit_doc == OmitDoc :: Skip && attr. has_name ( sym:: doc) {
239
238
continue ;
240
239
}
@@ -276,11 +275,11 @@ impl<'sess> AttributeParser<'sess> {
276
275
277
276
accept ( & cx, & args)
278
277
} else {
279
- // if we're here, we must be compiling a tool attribute... Or someone forgot to
280
- // parse their fancy new attribute. Let's warn them in any case. If you are that
281
- // person, and you really your attribute should remain unparsed, carefully read the
282
- // documentation in this module and if you still think so you can add an exception
283
- // to this assertion.
278
+ // If we're here, we must be compiling a tool attribute... Or someone
279
+ // forgot to parse their fancy new attribute. Let's warn them in any case.
280
+ // If you are that person, and you really think your attribute should
281
+ // remain unparsed, carefully read the documentation in this module and if
282
+ // you still think so you can add an exception to this assertion.
284
283
285
284
// FIXME(jdonszelmann): convert other attributes, and check with this that
286
285
// we caught em all
0 commit comments