diff options
Diffstat (limited to 'compiler/rustc_middle/src/hir/map/mod.rs')
| -rw-r--r-- | compiler/rustc_middle/src/hir/map/mod.rs | 7 |
1 files changed, 7 insertions, 0 deletions
diff --git a/compiler/rustc_middle/src/hir/map/mod.rs b/compiler/rustc_middle/src/hir/map/mod.rs index 2eafc356dc3..2df851a7857 100644 --- a/compiler/rustc_middle/src/hir/map/mod.rs +++ b/compiler/rustc_middle/src/hir/map/mod.rs @@ -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, |
