diff options
| author | Guillaume Gomez <guillaume1.gomez@gmail.com> | 2017-09-27 00:43:22 +0200 |
|---|---|---|
| committer | Guillaume Gomez <guillaume1.gomez@gmail.com> | 2017-10-07 13:16:20 +0200 |
| commit | 3493c62ff2628ef81f6f3a968c951252e9b57824 (patch) | |
| tree | 3e631433362998059ff91da9c138f2f2a9fd8511 | |
| parent | cce93436d3628f5fa8288c7e84f4b695542c6ae3 (diff) | |
| download | rust-3493c62ff2628ef81f6f3a968c951252e9b57824.tar.gz rust-3493c62ff2628ef81f6f3a968c951252e9b57824.zip | |
Add names to BareFnTy
| -rw-r--r-- | src/librustc/hir/intravisit.rs | 2 | ||||
| -rw-r--r-- | 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) => { |
