about summary refs log tree commit diff
path: root/compiler/rustc_hir_analysis/src
diff options
context:
space:
mode:
authorMatthias Krüger <matthias.krueger@famsik.de>2023-04-18 06:44:47 +0200
committerGitHub <noreply@github.com>2023-04-18 06:44:47 +0200
commitd97b39d3a0990d8d062f263e8e0898e0710a37e0 (patch)
tree5dcff2d39b754bc47c53b67d5e0ea299f8e4fd26 /compiler/rustc_hir_analysis/src
parentd6468916c0bdd98148970c8d6e51ecc935b9f47a (diff)
parent880da9fca96f59e2503c2ad0343177265e788ec4 (diff)
downloadrust-d97b39d3a0990d8d062f263e8e0898e0710a37e0.tar.gz
rust-d97b39d3a0990d8d062f263e8e0898e0710a37e0.zip
Rollup merge of #110461 - WaffleLapkin:expect_, r=Nilstrieb
Use `Item::expect_*` and `ImplItem::expect_*` more

r? ``@Nilstrieb``
Diffstat (limited to 'compiler/rustc_hir_analysis/src')
-rw-r--r--compiler/rustc_hir_analysis/src/coherence/builtin.rs7
1 files changed, 3 insertions, 4 deletions
diff --git a/compiler/rustc_hir_analysis/src/coherence/builtin.rs b/compiler/rustc_hir_analysis/src/coherence/builtin.rs
index 0f40cca9427..c2dc2a0f058 100644
--- a/compiler/rustc_hir_analysis/src/coherence/builtin.rs
+++ b/compiler/rustc_hir_analysis/src/coherence/builtin.rs
@@ -74,10 +74,9 @@ fn visit_implementation_of_copy(tcx: TyCtxt<'_>, impl_did: LocalDefId) {
 
     debug!("visit_implementation_of_copy: self_type={:?} (free)", self_type);
 
-    let span = match tcx.hir().expect_item(impl_did).kind {
-        ItemKind::Impl(hir::Impl { polarity: hir::ImplPolarity::Negative(_), .. }) => return,
-        ItemKind::Impl(impl_) => impl_.self_ty.span,
-        _ => bug!("expected Copy impl item"),
+    let span = match tcx.hir().expect_item(impl_did).expect_impl() {
+        hir::Impl { polarity: hir::ImplPolarity::Negative(_), .. } => return,
+        hir::Impl { self_ty, .. } => self_ty.span,
     };
 
     let cause = traits::ObligationCause::misc(span, impl_did);