Skip to content

Commit 6a90f14

Browse files
committed
Add check_attribute
1 parent 0194bed commit 6a90f14

File tree

1 file changed

+6
-0
lines changed

1 file changed

+6
-0
lines changed

src/librustc_lint/builtin.rs

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -227,6 +227,12 @@ impl UnsafeCode {
227227
}
228228

229229
impl<'a, 'tcx> LateLintPass<'a, 'tcx> for UnsafeCode {
230+
fn check_attribute(&mut self, cx: &LateContext, attr: &ast::Attribute) {
231+
if attr.check_name("allow_internal_unsafe") {
232+
self.report_unsafe(cx, attr.span, "`allow_internal_unsafe` allows defining macros using unsafe without triggering the `unsafe_code` lint at their call site");
233+
}
234+
}
235+
230236
fn check_expr(&mut self, cx: &LateContext, e: &hir::Expr) {
231237
if let hir::ExprKind::Block(ref blk, _) = e.node {
232238
// Don't warn about generated blocks, that'll just pollute the output.

0 commit comments

Comments
 (0)