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 {
13101310 Attribute :: Parsed ( AttributeKind :: Ignore { span, .. } ) => * span,
13111311 Attribute :: Parsed ( AttributeKind :: ShouldPanic { span, .. } ) => * span,
13121312 Attribute :: Parsed ( AttributeKind :: AutomaticallyDerived ( span) ) => * span,
1313+ Attribute :: Parsed ( AttributeKind :: AllowInternalUnsafe ( span) ) => * span,
13131314 a => panic ! ( "can't get the span of an arbitrary parsed attribute: {a:?}" ) ,
13141315 }
13151316 }
Original file line number Diff line number Diff line change 1414//! [`crate::late_lint_methods!`] invocation in `lib.rs`.
1515
1616use std:: fmt:: Write ;
17- use std:: slice;
1817
1918use ast:: token:: TokenKind ;
2019use rustc_abi:: BackendRepr ;
@@ -250,21 +249,6 @@ impl UnsafeCode {
250249}
251250
252251impl 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-
268252 #[ inline]
269253 fn check_expr ( & mut self , cx : & EarlyContext < ' _ > , e : & ast:: Expr ) {
270254 if let ast:: ExprKind :: Block ( ref blk, _) = e. kind {
@@ -323,6 +307,19 @@ impl EarlyLintPass for UnsafeCode {
323307 }
324308 }
325309
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+
326323 _ => { }
327324 }
328325 }
You can’t perform that action at this time.
0 commit comments