Skip to content

Commit 3ffe390

Browse files
committed
rustc: Print the types of declarations in --typed-pretty mode
1 parent 8637a4e commit 3ffe390

File tree

1 file changed

+9
-0
lines changed

1 file changed

+9
-0
lines changed

src/comp/pretty/pprust.rs

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -743,6 +743,15 @@ fn print_decl(ps s, @ast::decl decl) {
743743
}
744744
case (_) {
745745
wrd1(s, "auto");
746+
747+
// Print the type if necessary.
748+
alt (s.mode) {
749+
case (mo_untyped) { /* no-op */ }
750+
case (mo_typed(?tcx, ?ntt, ?tc)) {
751+
auto lty = ty::ann_to_type(ntt, loc.ann);
752+
wrd1(s, ty::ty_to_str(tcx, lty));
753+
}
754+
}
746755
}
747756
}
748757
wrd(s.s, loc.ident);

0 commit comments

Comments
 (0)