1
Fork 0

Add associated_items_for_impl_trait_in_trait query

This commit is contained in:
Santiago Pastorino 2022-10-26 16:38:32 -03:00
parent 833b9154ac
commit 4e703a2772
No known key found for this signature in database
GPG key ID: 8131A24E0C79EFAF
9 changed files with 68 additions and 4 deletions

View file

@ -849,6 +849,13 @@ impl<'hir> Map<'hir> {
}
}
pub fn get_fn_output(self, def_id: LocalDefId) -> Option<&'hir FnRetTy<'hir>> {
match self.tcx.hir_owner(OwnerId { def_id }) {
Some(Owner { node, .. }) => node.fn_decl().map(|fn_decl| &fn_decl.output),
_ => None,
}
}
pub fn expect_variant(self, id: HirId) -> &'hir Variant<'hir> {
match self.find(id) {
Some(Node::Variant(variant)) => variant,

View file

@ -767,6 +767,13 @@ rustc_queries! {
desc { |tcx| "comparing impl items against trait for `{}`", tcx.def_path_str(impl_id) }
}
/// Given an `fn_def_id`, create and return the associated items for that function.
query associated_items_for_impl_trait_in_trait(fn_def_id: DefId) -> &'tcx [DefId] {
desc { |tcx| "creating associated items for impl trait in trait returned by `{}`", tcx.def_path_str(fn_def_id) }
cache_on_disk_if { fn_def_id.is_local() }
separate_provide_extern
}
/// Given an `impl_id`, return the trait it implements.
/// Return `None` if this is an inherent impl.
query impl_trait_ref(impl_id: DefId) -> Option<ty::EarlyBinder<ty::TraitRef<'tcx>>> {