From 3493c62ff2628ef81f6f3a968c951252e9b57824 Mon Sep 17 00:00:00 2001 From: Guillaume Gomez Date: Wed, 27 Sep 2017 00:43:22 +0200 Subject: [PATCH] Add names to BareFnTy --- src/librustc/hir/intravisit.rs | 2 +- src/librustc/hir/lowering.rs | 10 +++++++++- 2 files changed, 10 insertions(+), 2 deletions(-) diff --git a/src/librustc/hir/intravisit.rs b/src/librustc/hir/intravisit.rs index 1755b3bca05..3130a88306e 100644 --- a/src/librustc/hir/intravisit.rs +++ b/src/librustc/hir/intravisit.rs @@ -574,7 +574,7 @@ pub fn walk_ty<'v, V: Visitor<'v>>(visitor: &mut V, typ: &'v Ty) { TyTup(ref tuple_element_types) => { walk_list!(visitor, visit_ty, tuple_element_types); } - TyBareFn(ref function_declaration) => { + TyBareFn(ref function_declaration, _) => { visitor.visit_fn_decl(&function_declaration.decl); walk_list!(visitor, visit_lifetime_def, &function_declaration.lifetimes); } diff --git a/src/librustc/hir/lowering.rs b/src/librustc/hir/lowering.rs index 1fdfbe20328..c03c9499608 100644 --- a/src/librustc/hir/lowering.rs +++ b/src/librustc/hir/lowering.rs @@ -673,7 +673,15 @@ impl<'a> LoweringContext<'a> { unsafety: self.lower_unsafety(f.unsafety), abi: f.abi, decl: self.lower_fn_decl(&f.decl), - })) + }, + decl.inputs.iter().map(|arg| { + match arg.pat.node { + PatKind::Ident(_, ident, None) => { + respan(ident.span, ident.node.name) + } + _ => respan(arg.pat.span, keywords::Invalid.name()), + } + }).collect())) } TyKind::Never => hir::TyNever, TyKind::Tup(ref tys) => {