diff options
| author | Matthias Krüger <matthias.krueger@famsik.de> | 2023-04-18 06:44:47 +0200 |
|---|---|---|
| committer | GitHub <noreply@github.com> | 2023-04-18 06:44:47 +0200 |
| commit | d97b39d3a0990d8d062f263e8e0898e0710a37e0 (patch) | |
| tree | 5dcff2d39b754bc47c53b67d5e0ea299f8e4fd26 /compiler/rustc_infer | |
| parent | d6468916c0bdd98148970c8d6e51ecc935b9f47a (diff) | |
| parent | 880da9fca96f59e2503c2ad0343177265e788ec4 (diff) | |
| download | rust-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_infer')
| -rw-r--r-- | compiler/rustc_infer/src/infer/error_reporting/note_and_explain.rs | 5 | ||||
| -rw-r--r-- | compiler/rustc_infer/src/infer/opaque_types.rs | 7 |
2 files changed, 2 insertions, 10 deletions
diff --git a/compiler/rustc_infer/src/infer/error_reporting/note_and_explain.rs b/compiler/rustc_infer/src/infer/error_reporting/note_and_explain.rs index b38bbdfe7bb..e410172c8c8 100644 --- a/compiler/rustc_infer/src/infer/error_reporting/note_and_explain.rs +++ b/compiler/rustc_infer/src/infer/error_reporting/note_and_explain.rs @@ -462,10 +462,7 @@ fn foo(&self) -> Self::T { String::new() } if let ty::Alias(ty::Opaque, ty::AliasTy { def_id, .. }) = *proj_ty.self_ty().kind() { let opaque_local_def_id = def_id.as_local(); let opaque_hir_ty = if let Some(opaque_local_def_id) = opaque_local_def_id { - match &tcx.hir().expect_item(opaque_local_def_id).kind { - hir::ItemKind::OpaqueTy(opaque_hir_ty) => opaque_hir_ty, - _ => bug!("The HirId comes from a `ty::Opaque`"), - } + tcx.hir().expect_item(opaque_local_def_id).expect_opaque_ty() } else { return false; }; diff --git a/compiler/rustc_infer/src/infer/opaque_types.rs b/compiler/rustc_infer/src/infer/opaque_types.rs index 3a0a0494a7e..680465bdab6 100644 --- a/compiler/rustc_infer/src/infer/opaque_types.rs +++ b/compiler/rustc_infer/src/infer/opaque_types.rs @@ -392,12 +392,7 @@ impl<'tcx> InferCtxt<'tcx> { /// defining scope. #[instrument(skip(self), level = "trace", ret)] fn opaque_type_origin_unchecked(&self, def_id: LocalDefId) -> OpaqueTyOrigin { - match self.tcx.hir().expect_item(def_id).kind { - hir::ItemKind::OpaqueTy(hir::OpaqueTy { origin, .. }) => origin, - ref itemkind => { - bug!("weird opaque type: {:?}, {:#?}", def_id, itemkind) - } - } + self.tcx.hir().expect_item(def_id).expect_opaque_ty().origin } } |
