Add pretty printer output for default

This commit is contained in:
Aaron Turon 2016-03-13 22:55:26 -07:00
parent dc45d924b6
commit 6562eeb053
3 changed files with 10 additions and 1 deletions

View File

@ -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));

View File

@ -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));

View File

@ -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 }