about summary refs log tree commit diff
path: root/compiler/rustc_hir_analysis/src
diff options
context:
space:
mode:
authorOli Scherer <github333195615777966@oli-obk.de>2025-06-04 08:46:49 +0000
committerOli Scherer <github333195615777966@oli-obk.de>2025-06-30 08:06:08 +0000
commit9b5d57d0a9d8ba75fd1602f62d0bfd9f2f6acd1e (patch)
tree237925507e6d88ad8e649ab24f2a9dfea62e726c /compiler/rustc_hir_analysis/src
parentcca072ca151d766bc9a40b82b1fc5e67ef5fee1e (diff)
downloadrust-9b5d57d0a9d8ba75fd1602f62d0bfd9f2f6acd1e.tar.gz
rust-9b5d57d0a9d8ba75fd1602f62d0bfd9f2f6acd1e.zip
Unconditionally run `check_item_type` on all items
Diffstat (limited to 'compiler/rustc_hir_analysis/src')
-rw-r--r--compiler/rustc_hir_analysis/src/check/check.rs4
-rw-r--r--compiler/rustc_hir_analysis/src/check/wfcheck.rs13
2 files changed, 4 insertions, 13 deletions
diff --git a/compiler/rustc_hir_analysis/src/check/check.rs b/compiler/rustc_hir_analysis/src/check/check.rs
index a361679e8ad..897900dd929 100644
--- a/compiler/rustc_hir_analysis/src/check/check.rs
+++ b/compiler/rustc_hir_analysis/src/check/check.rs
@@ -881,10 +881,6 @@ pub(crate) fn check_item_type(tcx: TyCtxt<'_>, def_id: LocalDefId) {
                     hir::ForeignItemKind::Fn(sig, _, _) => {
                         require_c_abi_if_c_variadic(tcx, sig.decl, abi, item.span);
                     }
-                    hir::ForeignItemKind::Static(..) => {
-                        check_static_inhabited(tcx, def_id);
-                        check_static_linkage(tcx, def_id);
-                    }
                     _ => {}
                 }
             }
diff --git a/compiler/rustc_hir_analysis/src/check/wfcheck.rs b/compiler/rustc_hir_analysis/src/check/wfcheck.rs
index dcb05ba072d..44a6e402ba7 100644
--- a/compiler/rustc_hir_analysis/src/check/wfcheck.rs
+++ b/compiler/rustc_hir_analysis/src/check/wfcheck.rs
@@ -185,6 +185,7 @@ where
 }
 
 fn check_well_formed(tcx: TyCtxt<'_>, def_id: LocalDefId) -> Result<(), ErrorGuaranteed> {
+    crate::check::check::check_item_type(tcx, def_id);
     let node = tcx.hir_node_by_def_id(def_id);
     let mut res = match node {
         hir::Node::Crate(_) => bug!("check_well_formed cannot be applied to the crate root"),
@@ -192,9 +193,7 @@ fn check_well_formed(tcx: TyCtxt<'_>, def_id: LocalDefId) -> Result<(), ErrorGua
         hir::Node::TraitItem(item) => check_trait_item(tcx, item),
         hir::Node::ImplItem(item) => check_impl_item(tcx, item),
         hir::Node::ForeignItem(item) => check_foreign_item(tcx, item),
-        hir::Node::ConstBlock(_) | hir::Node::Expr(_) | hir::Node::OpaqueTy(_) => {
-            Ok(crate::check::check::check_item_type(tcx, def_id))
-        }
+        hir::Node::ConstBlock(_) | hir::Node::Expr(_) | hir::Node::OpaqueTy(_) => Ok(()),
         _ => unreachable!("{node:?}"),
     };
 
@@ -228,7 +227,7 @@ fn check_item<'tcx>(tcx: TyCtxt<'tcx>, item: &'tcx hir::Item<'tcx>) -> Result<()
     );
     crate::collect::lower_item(tcx, item.item_id());
 
-    let res = match item.kind {
+    match item.kind {
         // Right now we check that every default trait implementation
         // has an implementation of itself. Basically, a case like:
         //
@@ -332,11 +331,7 @@ fn check_item<'tcx>(tcx: TyCtxt<'tcx>, item: &'tcx hir::Item<'tcx>) -> Result<()
             res
         }
         _ => Ok(()),
-    };
-
-    crate::check::check::check_item_type(tcx, def_id);
-
-    res
+    }
 }
 
 fn check_foreign_item<'tcx>(