diff options
| author | Oli Scherer <github333195615777966@oli-obk.de> | 2025-06-04 10:01:55 +0000 |
|---|---|---|
| committer | Oli Scherer <github333195615777966@oli-obk.de> | 2025-06-30 08:45:43 +0000 |
| commit | 362d4ddff4f9b3e6dae0c3ed203d6eb2090979e1 (patch) | |
| tree | 0e64d010a32e7102c70d8c02af12dc21b8411fc9 /compiler/rustc_hir_analysis/src/check/check.rs | |
| parent | 9b5d57d0a9d8ba75fd1602f62d0bfd9f2f6acd1e (diff) | |
| download | rust-362d4ddff4f9b3e6dae0c3ed203d6eb2090979e1.tar.gz rust-362d4ddff4f9b3e6dae0c3ed203d6eb2090979e1.zip | |
Don't look at static items' HIR for wfcheck
Diffstat (limited to 'compiler/rustc_hir_analysis/src/check/check.rs')
| -rw-r--r-- | compiler/rustc_hir_analysis/src/check/check.rs | 17 |
1 files changed, 8 insertions, 9 deletions
diff --git a/compiler/rustc_hir_analysis/src/check/check.rs b/compiler/rustc_hir_analysis/src/check/check.rs index 897900dd929..b00ef2288e9 100644 --- a/compiler/rustc_hir_analysis/src/check/check.rs +++ b/compiler/rustc_hir_analysis/src/check/check.rs @@ -729,7 +729,7 @@ fn check_static_linkage(tcx: TyCtxt<'_>, def_id: LocalDefId) { } } -pub(crate) fn check_item_type(tcx: TyCtxt<'_>, def_id: LocalDefId) { +pub(crate) fn check_item_type(tcx: TyCtxt<'_>, def_id: LocalDefId) -> Result<(), ErrorGuaranteed> { let generics = tcx.generics_of(def_id); for param in &generics.own_params { @@ -757,6 +757,7 @@ pub(crate) fn check_item_type(tcx: TyCtxt<'_>, def_id: LocalDefId) { DefKind::Static { .. } => { check_static_inhabited(tcx, def_id); check_static_linkage(tcx, def_id); + wfcheck::check_static_item(tcx, def_id)?; } DefKind::Const => {} DefKind::Enum => { @@ -774,13 +775,10 @@ pub(crate) fn check_item_type(tcx: TyCtxt<'_>, def_id: LocalDefId) { } DefKind::Impl { of_trait } => { if of_trait && let Some(impl_trait_header) = tcx.impl_trait_header(def_id) { - if tcx - .ensure_ok() - .coherent_trait(impl_trait_header.trait_ref.instantiate_identity().def_id) - .is_ok() - { - check_impl_items_against_trait(tcx, def_id, impl_trait_header); - } + tcx.ensure_ok() + .coherent_trait(impl_trait_header.trait_ref.instantiate_identity().def_id)?; + + check_impl_items_against_trait(tcx, def_id, impl_trait_header); } } DefKind::Trait => { @@ -838,7 +836,7 @@ pub(crate) fn check_item_type(tcx: TyCtxt<'_>, def_id: LocalDefId) { DefKind::ForeignMod => { let it = tcx.hir_expect_item(def_id); let hir::ItemKind::ForeignMod { abi, items } = it.kind else { - return; + return Ok(()); }; check_abi(tcx, it.hir_id(), it.span, abi); @@ -896,6 +894,7 @@ pub(crate) fn check_item_type(tcx: TyCtxt<'_>, def_id: LocalDefId) { } _ => {} } + Ok(()) } pub(super) fn check_on_unimplemented(tcx: TyCtxt<'_>, def_id: LocalDefId) { |
