Skip to content

Commit

Permalink
Add pretty printer output for default
Browse files Browse the repository at this point in the history
  • Loading branch information
aturon committed Mar 14, 2016
1 parent dc45d92 commit 6562eeb
Show file tree
Hide file tree
Showing 3 changed files with 10 additions and 1 deletion.
5 changes: 5 additions & 0 deletions src/librustc_front/print/pprust.rs
Original file line number Diff line number Diff line change
Expand Up @@ -1014,6 +1014,11 @@ impl<'a> State<'a> {
try!(self.hardbreak_if_not_bol());
try!(self.maybe_print_comment(ii.span.lo));
try!(self.print_outer_attributes(&ii.attrs));

if let hir::Defaultness::Default = ii.defaultness {
try!(self.word_nbsp("default"));
}

match ii.node {
hir::ImplItemKind::Const(ref ty, ref expr) => {
try!(self.print_associated_const(ii.name, &ty, Some(&expr), ii.vis));
Expand Down
3 changes: 3 additions & 0 deletions src/libsyntax/print/pprust.rs
Original file line number Diff line number Diff line change
Expand Up @@ -1582,6 +1582,9 @@ impl<'a> State<'a> {
try!(self.hardbreak_if_not_bol());
try!(self.maybe_print_comment(ii.span.lo));
try!(self.print_outer_attributes(&ii.attrs));
if let ast::Defaultness::Default = ii.defaultness {
try!(self.word_nbsp("default"));
}
match ii.node {
ast::ImplItemKind::Const(ref ty, ref expr) => {
try!(self.print_associated_const(ii.ident, &ty, Some(&expr), ii.vis));
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -63,7 +63,8 @@ trait Bar {
// / \
// Vec<i32> $Vec<i64>

impl<T> Bar for T {} // use the provided method
// use the provided method
impl<T> Bar for T {}

impl Bar for i32 {
fn bar(&self) -> i32 { 1 }
Expand Down

0 comments on commit 6562eeb

Please sign in to comment.