提交 05f8ddc4 编写于 作者: B bors

Auto merge of #44892 - GuillaumeGomez:fnty-args-rustdoc, r=eddyb

Fnty args rustdoc

Fixes #44570.

cc @QuietMisdreavus
cc @rust-lang/dev-tools

Considering the impact on the `hir` libs, I'll put @EddyB as reviewer.

r? @EddyB
......@@ -673,6 +673,7 @@ fn lower_ty(&mut self, t: &Ty) -> P<hir::Ty> {
unsafety: self.lower_unsafety(f.unsafety),
abi: f.abi,
decl: self.lower_fn_decl(&f.decl),
arg_names: self.lower_fn_args_to_names(&f.decl),
}))
}
TyKind::Never => hir::TyNever,
......
......@@ -1418,6 +1418,7 @@ pub struct BareFnTy {
pub abi: Abi,
pub lifetimes: HirVec<LifetimeDef>,
pub decl: P<FnDecl>,
pub arg_names: HirVec<Spanned<Name>>,
}
#[derive(Clone, PartialEq, Eq, RustcEncodable, RustcDecodable, Hash, Debug)]
......
......@@ -399,7 +399,8 @@ pub fn print_type(&mut self, ty: &hir::Ty) -> io::Result<()> {
},
span: syntax_pos::DUMMY_SP,
};
self.print_ty_fn(f.abi, f.unsafety, &f.decl, None, &generics)?;
self.print_ty_fn(f.abi, f.unsafety, &f.decl, None, &generics,
&f.arg_names[..])?;
}
hir::TyPath(ref qpath) => {
self.print_qpath(qpath, false)?
......@@ -2140,7 +2141,8 @@ pub fn print_ty_fn(&mut self,
unsafety: hir::Unsafety,
decl: &hir::FnDecl,
name: Option<ast::Name>,
generics: &hir::Generics)
generics: &hir::Generics,
arg_names: &[Spanned<ast::Name>])
-> io::Result<()> {
self.ibox(indent_unit)?;
if !generics.lifetimes.is_empty() || !generics.ty_params.is_empty() {
......@@ -2163,7 +2165,7 @@ pub fn print_ty_fn(&mut self,
name,
&generics,
&hir::Inherited,
&[],
arg_names,
None)?;
self.end()
}
......
......@@ -274,7 +274,8 @@ fn hash_stable<W: StableHasherResult>(&self,
unsafety,
abi,
lifetimes,
decl
decl,
arg_names
});
impl_stable_hash_for!(enum hir::Ty_ {
......
......@@ -2491,7 +2491,7 @@ fn clean(&self, cx: &DocContext) -> BareFunctionDecl {
type_params: Vec::new(),
where_predicates: Vec::new()
},
decl: (&*self.decl, &[][..]).clean(cx),
decl: (&*self.decl, &self.arg_names[..]).clean(cx),
abi: self.abi,
}
}
......
// Copyright 2017 The Rust Project Developers. See the COPYRIGHT
// file at the top-level directory of this distribution and at
// http://rust-lang.org/COPYRIGHT.
//
// Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or
// http://www.apache.org/licenses/LICENSE-2.0> or the MIT license
// <LICENSE-MIT or http://opensource.org/licenses/MIT>, at your
// option. This file may not be copied, modified, or distributed
// except according to those terms.
#![crate_name = "foo"]
// @has foo/fn.f.html
// @has - '//*[@class="rust fn"]' 'pub fn f(callback: fn(len: usize, foo: u32))'
pub fn f(callback: fn(len: usize, foo: u32)) {}
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册