@@ -1299,12 +1299,51 @@ impl AttributeExt for Attribute {
12991299 fn span ( & self ) -> Span {
13001300 match & self {
13011301 Attribute :: Unparsed ( u) => u. span ,
1302- // FIXME: should not be needed anymore when all attrs are parsed
1303- Attribute :: Parsed ( AttributeKind :: Deprecation { span, .. } ) => * span,
1304- Attribute :: Parsed ( AttributeKind :: DocComment { span, .. } ) => * span,
1305- Attribute :: Parsed ( AttributeKind :: MayDangle ( span) ) => * span,
1306- Attribute :: Parsed ( AttributeKind :: Ignore { span, .. } ) => * span,
1307- a => panic ! ( "can't get the span of an arbitrary parsed attribute: {a:?}" ) ,
1302+ Attribute :: Parsed ( kind) => match kind {
1303+ AttributeKind :: Align { span, .. }
1304+ | AttributeKind :: AllowConstFnUnstable ( _, span)
1305+ | AttributeKind :: AllowInternalUnstable ( _, span)
1306+ | AttributeKind :: AsPtr ( span)
1307+ | AttributeKind :: BodyStability { span, .. }
1308+ | AttributeKind :: Cold ( span)
1309+ | AttributeKind :: Confusables { first_span : span, .. }
1310+ | AttributeKind :: ConstContinue ( span)
1311+ | AttributeKind :: ConstStability { span, .. }
1312+ | AttributeKind :: ConstStabilityIndirect ( span)
1313+ | AttributeKind :: Deprecation { span, .. }
1314+ | AttributeKind :: DocComment { span, .. }
1315+ | AttributeKind :: Dummy ( span)
1316+ | AttributeKind :: ExportName { span, .. }
1317+ | AttributeKind :: ExportStable ( span)
1318+ | AttributeKind :: FfiConst ( span)
1319+ | AttributeKind :: FfiPure ( span)
1320+ | AttributeKind :: Ignore { span, .. }
1321+ | AttributeKind :: Inline ( _, span)
1322+ | AttributeKind :: LinkName { span, .. }
1323+ | AttributeKind :: LinkSection { span, .. }
1324+ | AttributeKind :: LoopMatch ( span)
1325+ | AttributeKind :: MacroTransparency ( .., span)
1326+ | AttributeKind :: MayDangle ( span)
1327+ | AttributeKind :: MustUse { span, .. }
1328+ | AttributeKind :: Naked ( span)
1329+ | AttributeKind :: NoImplicitPrelude ( span)
1330+ | AttributeKind :: NoMangle ( span)
1331+ | AttributeKind :: NonExhaustive ( span)
1332+ | AttributeKind :: Optimize ( _, span)
1333+ | AttributeKind :: PassByValue ( span)
1334+ | AttributeKind :: Path ( _, span)
1335+ | AttributeKind :: PubTransparent ( span)
1336+ | AttributeKind :: Repr { first_span : span, .. }
1337+ | AttributeKind :: RustcLayoutScalarValidRangeEnd ( _, span)
1338+ | AttributeKind :: RustcLayoutScalarValidRangeStart ( _, span)
1339+ | AttributeKind :: RustcObjectLifetimeDefault ( span)
1340+ | AttributeKind :: SkipDuringMethodDispatch { span, .. }
1341+ | AttributeKind :: Stability { span, .. }
1342+ | AttributeKind :: StdInternalSymbol ( span)
1343+ | AttributeKind :: TargetFeature ( _, span)
1344+ | AttributeKind :: TrackCaller ( span)
1345+ | AttributeKind :: Used { span, .. } => * span,
1346+ } ,
13081347 }
13091348 }
13101349
0 commit comments