diff options
| author | bors <bors@rust-lang.org> | 2025-08-08 02:59:15 +0000 |
|---|---|---|
| committer | bors <bors@rust-lang.org> | 2025-08-08 02:59:15 +0000 |
| commit | 67d45f49e09cb8f355df2ffae22cfc3d7ee6c278 (patch) | |
| tree | 6b047e9f86783661cb94989020c6be8f602fc938 /compiler/rustc_lint/src/builtin.rs | |
| parent | a980cd4311ae4b5bf9099d418e32643d068f1344 (diff) | |
| parent | 338a3e0b21ffc407a0ac106ec2e94e119691db74 (diff) | |
| download | rust-67d45f49e09cb8f355df2ffae22cfc3d7ee6c278.tar.gz rust-67d45f49e09cb8f355df2ffae22cfc3d7ee6c278.zip | |
Auto merge of #145074 - tgross35:rollup-0tillrm, r=tgross35
Rollup of 9 pull requests Successful merges: - rust-lang/rust#144705 (compiler-builtins: plumb LSE support for aarch64 on linux/gnu when optimized-compiler-builtins not enabled) - rust-lang/rust#144857 (Port `#[allow_internal_unsafe]` to the new attribute system) - rust-lang/rust#144900 (Stabilize `unsigned_signed_diff` feature) - rust-lang/rust#144903 (Rename `begin_panic_handler` to `panic_handler`) - rust-lang/rust#144974 (compiler-builtins subtree update) - rust-lang/rust#145007 (Fix build/doc/test of error index generator) - rust-lang/rust#145018 (Derive `Hash` for rustc_public types) - rust-lang/rust#145045 (doc(library): Fix Markdown in `Iterator::by_ref`) - rust-lang/rust#145046 (Fix doc comment of File::try_lock and File::try_lock_shared) r? `@ghost` `@rustbot` modify labels: rollup
Diffstat (limited to 'compiler/rustc_lint/src/builtin.rs')
| -rw-r--r-- | compiler/rustc_lint/src/builtin.rs | 13 |
1 files changed, 12 insertions, 1 deletions
diff --git a/compiler/rustc_lint/src/builtin.rs b/compiler/rustc_lint/src/builtin.rs index c893b723375..51b10191046 100644 --- a/compiler/rustc_lint/src/builtin.rs +++ b/compiler/rustc_lint/src/builtin.rs @@ -14,6 +14,7 @@ //! [`crate::late_lint_methods!`] invocation in `lib.rs`. use std::fmt::Write; +use std::slice; use ast::token::TokenKind; use rustc_abi::BackendRepr; @@ -21,6 +22,7 @@ use rustc_ast::tokenstream::{TokenStream, TokenTree}; use rustc_ast::visit::{FnCtxt, FnKind}; use rustc_ast::{self as ast, *}; use rustc_ast_pretty::pprust::expr_to_string; +use rustc_attr_parsing::AttributeParser; use rustc_errors::{Applicability, LintDiagnostic}; use rustc_feature::GateIssue; use rustc_hir as hir; @@ -249,7 +251,16 @@ impl UnsafeCode { impl EarlyLintPass for UnsafeCode { fn check_attribute(&mut self, cx: &EarlyContext<'_>, attr: &ast::Attribute) { - if attr.has_name(sym::allow_internal_unsafe) { + if AttributeParser::parse_limited( + cx.builder.sess(), + slice::from_ref(attr), + sym::allow_internal_unsafe, + attr.span, + DUMMY_NODE_ID, + Some(cx.builder.features()), + ) + .is_some() + { self.report_unsafe(cx, attr.span, BuiltinUnsafe::AllowInternalUnsafe); } } |
