File tree Expand file tree Collapse file tree 2 files changed +14
-16
lines changed Expand file tree Collapse file tree 2 files changed +14
-16
lines changed Original file line number Diff line number Diff line change @@ -1310,6 +1310,7 @@ impl AttributeExt for Attribute {
1310
1310
Attribute :: Parsed ( AttributeKind :: Ignore { span, .. } ) => * span,
1311
1311
Attribute :: Parsed ( AttributeKind :: ShouldPanic { span, .. } ) => * span,
1312
1312
Attribute :: Parsed ( AttributeKind :: AutomaticallyDerived ( span) ) => * span,
1313
+ Attribute :: Parsed ( AttributeKind :: AllowInternalUnsafe ( span) ) => * span,
1313
1314
a => panic ! ( "can't get the span of an arbitrary parsed attribute: {a:?}" ) ,
1314
1315
}
1315
1316
}
Original file line number Diff line number Diff line change 14
14
//! [`crate::late_lint_methods!`] invocation in `lib.rs`.
15
15
16
16
use std:: fmt:: Write ;
17
- use std:: slice;
18
17
19
18
use ast:: token:: TokenKind ;
20
19
use rustc_abi:: BackendRepr ;
@@ -250,21 +249,6 @@ impl UnsafeCode {
250
249
}
251
250
252
251
impl EarlyLintPass for UnsafeCode {
253
- fn check_attribute ( & mut self , cx : & EarlyContext < ' _ > , attr : & ast:: Attribute ) {
254
- if AttributeParser :: parse_limited (
255
- cx. builder . sess ( ) ,
256
- slice:: from_ref ( attr) ,
257
- sym:: allow_internal_unsafe,
258
- attr. span ,
259
- DUMMY_NODE_ID ,
260
- Some ( cx. builder . features ( ) ) ,
261
- )
262
- . is_some ( )
263
- {
264
- self . report_unsafe ( cx, attr. span , BuiltinUnsafe :: AllowInternalUnsafe ) ;
265
- }
266
- }
267
-
268
252
#[ inline]
269
253
fn check_expr ( & mut self , cx : & EarlyContext < ' _ > , e : & ast:: Expr ) {
270
254
if let ast:: ExprKind :: Block ( ref blk, _) = e. kind {
@@ -323,6 +307,19 @@ impl EarlyLintPass for UnsafeCode {
323
307
}
324
308
}
325
309
310
+ ast:: ItemKind :: MacroDef ( ..) => {
311
+ if let Some ( attr) = AttributeParser :: parse_limited (
312
+ cx. builder . sess ( ) ,
313
+ & it. attrs ,
314
+ sym:: allow_internal_unsafe,
315
+ it. span ,
316
+ DUMMY_NODE_ID ,
317
+ Some ( cx. builder . features ( ) ) ,
318
+ ) {
319
+ self . report_unsafe ( cx, attr. span ( ) , BuiltinUnsafe :: AllowInternalUnsafe ) ;
320
+ }
321
+ }
322
+
326
323
_ => { }
327
324
}
328
325
}
You can’t perform that action at this time.
0 commit comments