1
Fork 0

Use FnSig instead of raw FnDecl for ForeignItemKind::Fn

This commit is contained in:
Michael Goulet 2024-08-07 13:01:34 -04:00
parent a73bc4a131
commit 833af65f38
23 changed files with 113 additions and 98 deletions

View file

@ -826,6 +826,11 @@ impl<'hir> Map<'hir> {
})
| Node::ImplItem(ImplItem {
kind: ImplItemKind::Fn(sig, ..), span: outer_span, ..
})
| Node::ForeignItem(ForeignItem {
kind: ForeignItemKind::Fn(sig, ..),
span: outer_span,
..
}) => {
// Ensure that the returned span has the item's SyntaxContext, and not the
// SyntaxContext of the visibility.
@ -884,10 +889,7 @@ impl<'hir> Map<'hir> {
},
Node::Variant(variant) => named_span(variant.span, variant.ident, None),
Node::ImplItem(item) => named_span(item.span, item.ident, Some(item.generics)),
Node::ForeignItem(item) => match item.kind {
ForeignItemKind::Fn(decl, _, _, _) => until_within(item.span, decl.output.span()),
_ => named_span(item.span, item.ident, None),
},
Node::ForeignItem(item) => named_span(item.span, item.ident, None),
Node::Ctor(_) => return self.span(self.tcx.parent_hir_id(hir_id)),
Node::Expr(Expr {
kind: ExprKind::Closure(Closure { fn_decl_span, .. }),

View file

@ -202,7 +202,7 @@ pub fn provide(providers: &mut Providers) {
..
})
| Node::ForeignItem(&ForeignItem {
kind: ForeignItemKind::Fn(_, idents, _, _),
kind: ForeignItemKind::Fn(_, idents, _),
..
}) = tcx.hir_node(tcx.local_def_id_to_hir_id(def_id))
{