Skip to content

Commit 4f23850

Browse files
committed
rustdoc: Document explicit self in methods. Closes #5254
1 parent 58f248d commit 4f23850

File tree

2 files changed

+6
-2
lines changed

2 files changed

+6
-2
lines changed

src/librustdoc/tystr_pass.rs

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -75,7 +75,7 @@ fn get_fn_sig(srv: astsrv::Srv, fn_id: doc::AstId) -> Option<~str> {
7575
ident: ident,
7676
node: ast::foreign_item_fn(ref decl, _, ref tys), _
7777
}, _, _) => {
78-
Some(pprust::fun_to_str(decl, ident, tys,
78+
Some(pprust::fun_to_str(decl, ident, None, tys,
7979
extract::interner()))
8080
}
8181
_ => fail!(~"get_fn_sig: fn_id not bound to a fn item")
@@ -215,6 +215,7 @@ fn get_method_sig(
215215
Some(pprust::fun_to_str(
216216
&ty_m.decl,
217217
ty_m.ident,
218+
Some(ty_m.self_ty.node),
218219
&ty_m.generics,
219220
extract::interner()
220221
))
@@ -223,6 +224,7 @@ fn get_method_sig(
223224
Some(pprust::fun_to_str(
224225
&m.decl,
225226
m.ident,
227+
Some(m.self_ty.node),
226228
&m.generics,
227229
extract::interner()
228230
))
@@ -242,6 +244,7 @@ fn get_method_sig(
242244
Some(pprust::fun_to_str(
243245
&method.decl,
244246
method.ident,
247+
Some(method.self_ty.node),
245248
&method.generics,
246249
extract::interner()
247250
))

src/libsyntax/print/pprust.rs

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -181,10 +181,11 @@ pub fn path_to_str(&&p: @ast::path, intr: @ident_interner) -> ~str {
181181
}
182182

183183
pub fn fun_to_str(decl: &ast::fn_decl, name: ast::ident,
184+
opt_self_ty: Option<ast::self_ty_>,
184185
generics: &ast::Generics, intr: @ident_interner) -> ~str {
185186
do io::with_str_writer |wr| {
186187
let s = rust_printer(wr, intr);
187-
print_fn(s, decl, None, name, generics, None, ast::inherited);
188+
print_fn(s, decl, None, name, generics, opt_self_ty, ast::inherited);
188189
end(s); // Close the head box
189190
end(s); // Close the outer box
190191
eof(s.s);

0 commit comments

Comments
 (0)