about summary refs log tree commit diff
path: root/compiler/rustc_lint/src/builtin.rs
diff options
context:
space:
mode:
authorStuart Cook <Zalathar@users.noreply.github.com>2025-08-12 20:37:49 +1000
committerGitHub <noreply@github.com>2025-08-12 20:37:49 +1000
commit378a26f16525704e44006e5b9be57f9b6a1a9abb (patch)
tree66f992d5244723ca68ed15943e6229a6196369eb /compiler/rustc_lint/src/builtin.rs
parent52f92d540cf9a1cd72a79e9e731a354447644543 (diff)
parentbf266dc8341755f0f7ac6de1cfa474875f79b3d9 (diff)
downloadrust-378a26f16525704e44006e5b9be57f9b6a1a9abb.tar.gz
rust-378a26f16525704e44006e5b9be57f9b6a1a9abb.zip
Rollup merge of #144386 - camsteffen:imploftrait, r=fmease
Extract TraitImplHeader in AST/HIR

Several fields of `Impl` are only applicable when it's a trait impl. This moves those fields into a new struct that is only present for trait impls.
Diffstat (limited to 'compiler/rustc_lint/src/builtin.rs')
-rw-r--r--compiler/rustc_lint/src/builtin.rs5
1 files changed, 4 insertions, 1 deletions
diff --git a/compiler/rustc_lint/src/builtin.rs b/compiler/rustc_lint/src/builtin.rs
index c893b723375..54769f9e097 100644
--- a/compiler/rustc_lint/src/builtin.rs
+++ b/compiler/rustc_lint/src/builtin.rs
@@ -270,7 +270,10 @@ impl EarlyLintPass for UnsafeCode {
                 self.report_unsafe(cx, it.span, BuiltinUnsafe::UnsafeTrait);
             }
 
-            ast::ItemKind::Impl(box ast::Impl { safety: ast::Safety::Unsafe(_), .. }) => {
+            ast::ItemKind::Impl(ast::Impl {
+                of_trait: Some(box ast::TraitImplHeader { safety: ast::Safety::Unsafe(_), .. }),
+                ..
+            }) => {
                 self.report_unsafe(cx, it.span, BuiltinUnsafe::UnsafeImpl);
             }