Move opaque_type_origin_unchecked
onto TyCtxt
and re-use it where it was open coded
This commit is contained in:
parent
fa06a371b7
commit
c8979e587b
6 changed files with 14 additions and 15 deletions
|
@ -1138,8 +1138,8 @@ fn should_encode_type(tcx: TyCtxt<'_>, def_id: LocalDefId, def_kind: DefKind) ->
|
|||
| DefKind::InlineConst => true,
|
||||
|
||||
DefKind::OpaqueTy => {
|
||||
let opaque = tcx.hir().expect_item(def_id).expect_opaque_ty();
|
||||
if let hir::OpaqueTyOrigin::FnReturn(fn_def_id) | hir::OpaqueTyOrigin::AsyncFn(fn_def_id) = opaque.origin
|
||||
let origin = tcx.opaque_type_origin(def_id);
|
||||
if let hir::OpaqueTyOrigin::FnReturn(fn_def_id) | hir::OpaqueTyOrigin::AsyncFn(fn_def_id) = origin
|
||||
&& let hir::Node::TraitItem(trait_item) = tcx.hir().get_by_def_id(fn_def_id)
|
||||
&& let (_, hir::TraitFn::Required(..)) = trait_item.expect_fn()
|
||||
{
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue