Function rustc_infer::infer::opaque_types::may_define_opaque_type
source · fn may_define_opaque_type(
tcx: TyCtxt<'_>,
def_id: LocalDefId,
opaque_hir_id: HirId
) -> boolExpand description
Returns true if opaque_hir_id is a sibling or a child of a sibling of def_id.
Example:
ⓘ
pub mod foo {
pub mod bar {
pub trait Bar { /* ... */ }
pub type Baz = impl Bar;
fn f1() -> Baz { /* ... */ }
}
fn f2() -> bar::Baz { /* ... */ }
}Here, def_id is the LocalDefId of the defining use of the opaque type (e.g., f1 or f2),
and opaque_hir_id is the HirId of the definition of the opaque type Baz.
For the above example, this function returns true for f1 and false for f2.