@@ -253,9 +253,9 @@ impl<'a> StripUnconfigured<'a> {
253
253
/// Gives a compiler warning when the `cfg_attr` contains no attributes and
254
254
/// is in the original source file. Gives a compiler error if the syntax of
255
255
/// the attribute is incorrect.
256
- pub ( crate ) fn expand_cfg_attr ( & self , attr : & Attribute , recursive : bool ) -> Vec < Attribute > {
256
+ pub ( crate ) fn expand_cfg_attr ( & self , cfg_attr : & Attribute , recursive : bool ) -> Vec < Attribute > {
257
257
let Some ( ( cfg_predicate, expanded_attrs) ) =
258
- rustc_parse:: parse_cfg_attr ( attr , & self . sess . psess )
258
+ rustc_parse:: parse_cfg_attr ( cfg_attr , & self . sess . psess )
259
259
else {
260
260
return vec ! [ ] ;
261
261
} ;
@@ -264,7 +264,7 @@ impl<'a> StripUnconfigured<'a> {
264
264
if expanded_attrs. is_empty ( ) {
265
265
self . sess . psess . buffer_lint (
266
266
rustc_lint_defs:: builtin:: UNUSED_ATTRIBUTES ,
267
- attr . span ,
267
+ cfg_attr . span ,
268
268
ast:: CRATE_NODE_ID ,
269
269
BuiltinLintDiag :: CfgAttrNoAttributes ,
270
270
) ;
@@ -280,16 +280,16 @@ impl<'a> StripUnconfigured<'a> {
280
280
// `#[cfg_attr(false, cfg_attr(true, some_attr))]`.
281
281
expanded_attrs
282
282
. into_iter ( )
283
- . flat_map ( |item| self . process_cfg_attr ( & self . expand_cfg_attr_item ( attr , item) ) )
283
+ . flat_map ( |item| self . process_cfg_attr ( & self . expand_cfg_attr_item ( cfg_attr , item) ) )
284
284
. collect ( )
285
285
} else {
286
- expanded_attrs. into_iter ( ) . map ( |item| self . expand_cfg_attr_item ( attr , item) ) . collect ( )
286
+ expanded_attrs. into_iter ( ) . map ( |item| self . expand_cfg_attr_item ( cfg_attr , item) ) . collect ( )
287
287
}
288
288
}
289
289
290
290
fn expand_cfg_attr_item (
291
291
& self ,
292
- attr : & Attribute ,
292
+ cfg_attr : & Attribute ,
293
293
( item, item_span) : ( ast:: AttrItem , Span ) ,
294
294
) -> Attribute {
295
295
// We are taking an attribute of the form `#[cfg_attr(pred, attr)]`
@@ -300,11 +300,11 @@ impl<'a> StripUnconfigured<'a> {
300
300
301
301
// Use the `#` in `#[cfg_attr(pred, attr)]` as the `#` token
302
302
// for `attr` when we expand it to `#[attr]`
303
- let mut orig_trees = attr . token_trees ( ) . into_iter ( ) ;
303
+ let mut orig_trees = cfg_attr . token_trees ( ) . into_iter ( ) ;
304
304
let TokenTree :: Token ( pound_token @ Token { kind : TokenKind :: Pound , .. } , _) =
305
305
orig_trees. next ( ) . unwrap ( ) . clone ( )
306
306
else {
307
- panic ! ( "Bad tokens for attribute {attr :?}" ) ;
307
+ panic ! ( "Bad tokens for attribute {cfg_attr :?}" ) ;
308
308
} ;
309
309
310
310
// We don't really have a good span to use for the synthesized `[]`
@@ -318,12 +318,12 @@ impl<'a> StripUnconfigured<'a> {
318
318
. unwrap_or_else ( || panic ! ( "Missing tokens for {item:?}" ) )
319
319
. to_attr_token_stream ( ) ,
320
320
) ;
321
- let trees = if attr . style == AttrStyle :: Inner {
321
+ let trees = if cfg_attr . style == AttrStyle :: Inner {
322
322
// For inner attributes, we do the same thing for the `!` in `#![some_attr]`
323
323
let TokenTree :: Token ( bang_token @ Token { kind : TokenKind :: Not , .. } , _) =
324
324
orig_trees. next ( ) . unwrap ( ) . clone ( )
325
325
else {
326
- panic ! ( "Bad tokens for attribute {attr :?}" ) ;
326
+ panic ! ( "Bad tokens for attribute {cfg_attr :?}" ) ;
327
327
} ;
328
328
vec ! [
329
329
AttrTokenTree :: Token ( pound_token, Spacing :: Joint ) ,
@@ -338,7 +338,7 @@ impl<'a> StripUnconfigured<'a> {
338
338
& self . sess . psess . attr_id_generator ,
339
339
item,
340
340
tokens,
341
- attr . style ,
341
+ cfg_attr . style ,
342
342
item_span,
343
343
) ;
344
344
if attr. has_name ( sym:: crate_type) {
0 commit comments