Skip to content

Commit 6562eeb

Browse files
committed
Add pretty printer output for default
1 parent dc45d92 commit 6562eeb

File tree

3 files changed

+10
-1
lines changed

3 files changed

+10
-1
lines changed

src/librustc_front/print/pprust.rs

+5
Original file line numberDiff line numberDiff line change
@@ -1014,6 +1014,11 @@ impl<'a> State<'a> {
10141014
try!(self.hardbreak_if_not_bol());
10151015
try!(self.maybe_print_comment(ii.span.lo));
10161016
try!(self.print_outer_attributes(&ii.attrs));
1017+
1018+
if let hir::Defaultness::Default = ii.defaultness {
1019+
try!(self.word_nbsp("default"));
1020+
}
1021+
10171022
match ii.node {
10181023
hir::ImplItemKind::Const(ref ty, ref expr) => {
10191024
try!(self.print_associated_const(ii.name, &ty, Some(&expr), ii.vis));

src/libsyntax/print/pprust.rs

+3
Original file line numberDiff line numberDiff line change
@@ -1582,6 +1582,9 @@ impl<'a> State<'a> {
15821582
try!(self.hardbreak_if_not_bol());
15831583
try!(self.maybe_print_comment(ii.span.lo));
15841584
try!(self.print_outer_attributes(&ii.attrs));
1585+
if let ast::Defaultness::Default = ii.defaultness {
1586+
try!(self.word_nbsp("default"));
1587+
}
15851588
match ii.node {
15861589
ast::ImplItemKind::Const(ref ty, ref expr) => {
15871590
try!(self.print_associated_const(ii.ident, &ty, Some(&expr), ii.vis));

src/test/run-pass/specialization/specialization-default-methods.rs

+2-1
Original file line numberDiff line numberDiff line change
@@ -63,7 +63,8 @@ trait Bar {
6363
// / \
6464
// Vec<i32> $Vec<i64>
6565

66-
impl<T> Bar for T {} // use the provided method
66+
// use the provided method
67+
impl<T> Bar for T {}
6768

6869
impl Bar for i32 {
6970
fn bar(&self) -> i32 { 1 }

0 commit comments

Comments
 (0)