File tree 1 file changed +9
-1
lines changed
1 file changed +9
-1
lines changed Original file line number Diff line number Diff line change @@ -227,8 +227,16 @@ impl<'a> Parser<'a> {
227
227
if !parser. eat_keyword ( kw:: If ) {
228
228
return Err ( "Expected `if`" ) ;
229
229
}
230
+ // Inner attributes are not actually syntactically permitted here, but we don't
231
+ // care about inner vs outer attributes in this position. Our purpose with this
232
+ // special case parsing of cfg_if macros is to ensure we can correctly resolve
233
+ // imported modules that may have a custom `path` defined.
234
+ //
235
+ // As such, we just need to advance the parser past the attribute and up to
236
+ // to the opening brace.
237
+ // See also https://github.com/rust-lang/rust/pull/79433
230
238
parser
231
- . parse_attribute ( false )
239
+ . parse_attribute ( rustc_parse :: parser :: attr :: InnerAttrPolicy :: Permitted )
232
240
. map_err ( |_| "Failed to parse attributes" ) ?;
233
241
}
234
242
You can’t perform that action at this time.
0 commit comments