Rollup merge of #110461 - WaffleLapkin:expect_, r=Nilstrieb
Use `Item::expect_*` and `ImplItem::expect_*` more r? ``@Nilstrieb``
This commit is contained in:
commit
d97b39d3a0
6 changed files with 11 additions and 24 deletions
|
@ -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;
|
||||
};
|
||||
|
|
|
@ -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
|
||||
}
|
||||
}
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue