File tree Expand file tree Collapse file tree 3 files changed +13
-13
lines changed Expand file tree Collapse file tree 3 files changed +13
-13
lines changed Original file line number Diff line number Diff line change @@ -279,15 +279,15 @@ fn process_builtin_attrs(
279279 AttributeKind :: StdInternalSymbol ( _) => {
280280 codegen_fn_attrs. flags |= CodegenFnAttrFlags :: RUSTC_STD_INTERNAL_SYMBOL
281281 }
282- AttributeKind :: Linkage ( linkage, _ ) => {
282+ AttributeKind :: Linkage ( linkage, span ) => {
283283 let linkage = Some ( * linkage) ;
284284
285285 if tcx. is_foreign_item ( did) {
286286 codegen_fn_attrs. import_linkage = linkage;
287287
288288 if tcx. is_mutable_static ( did. into ( ) ) {
289289 let mut diag = tcx. dcx ( ) . struct_span_err (
290- attr . span ( ) ,
290+ * span,
291291 "extern mutable statics are not allowed with `#[linkage]`" ,
292292 ) ;
293293 diag. note (
Original file line number Diff line number Diff line change @@ -1315,8 +1315,6 @@ impl AttributeExt for Attribute {
13151315 // FIXME: should not be needed anymore when all attrs are parsed
13161316 Attribute :: Parsed ( AttributeKind :: DocComment { span, .. } ) => * span,
13171317 Attribute :: Parsed ( AttributeKind :: Deprecation { span, .. } ) => * span,
1318- Attribute :: Parsed ( AttributeKind :: AllowInternalUnsafe ( span) ) => * span,
1319- Attribute :: Parsed ( AttributeKind :: Linkage ( _, span) ) => * span,
13201318 a => panic ! ( "can't get the span of an arbitrary parsed attribute: {a:?}" ) ,
13211319 }
13221320 }
Original file line number Diff line number Diff line change @@ -310,15 +310,17 @@ impl EarlyLintPass for UnsafeCode {
310310 }
311311
312312 ast:: ItemKind :: MacroDef ( ..) => {
313- if let Some ( attr) = AttributeParser :: parse_limited (
314- cx. builder . sess ( ) ,
315- & it. attrs ,
316- sym:: allow_internal_unsafe,
317- it. span ,
318- DUMMY_NODE_ID ,
319- Some ( cx. builder . features ( ) ) ,
320- ) {
321- self . report_unsafe ( cx, attr. span ( ) , BuiltinUnsafe :: AllowInternalUnsafe ) ;
313+ if let Some ( hir:: Attribute :: Parsed ( AttributeKind :: AllowInternalUnsafe ( span) ) ) =
314+ AttributeParser :: parse_limited (
315+ cx. builder . sess ( ) ,
316+ & it. attrs ,
317+ sym:: allow_internal_unsafe,
318+ it. span ,
319+ DUMMY_NODE_ID ,
320+ Some ( cx. builder . features ( ) ) ,
321+ )
322+ {
323+ self . report_unsafe ( cx, span, BuiltinUnsafe :: AllowInternalUnsafe ) ;
322324 }
323325 }
324326
You can’t perform that action at this time.
0 commit comments