about summary refs log tree commit diff
path: root/src/libsyntax
diff options
context:
space:
mode:
authorEduard Burtescu <edy.burt@gmail.com>2015-02-24 12:12:14 +0200
committerEduard Burtescu <edy.burt@gmail.com>2015-02-24 14:16:03 +0200
commit0c6d1f3b3d22f45c53c8be0a799a6cc42bc752d5 (patch)
tree0f912e2b454d5f710cac2df57f90f5bcb7e88086 /src/libsyntax
parent72d5f39be7e7fe59f827345fce423535a343c432 (diff)
downloadrust-0c6d1f3b3d22f45c53c8be0a799a6cc42bc752d5.tar.gz
rust-0c6d1f3b3d22f45c53c8be0a799a6cc42bc752d5.zip
syntax: update pretty-printer for the `<T>::method` shorthand.
Diffstat (limited to 'src/libsyntax')
-rw-r--r--src/libsyntax/print/pprust.rs9
1 files changed, 6 insertions, 3 deletions
diff --git a/src/libsyntax/print/pprust.rs b/src/libsyntax/print/pprust.rs
index 78b9487d1c9..af16e19c9f0 100644
--- a/src/libsyntax/print/pprust.rs
+++ b/src/libsyntax/print/pprust.rs
@@ -2048,9 +2048,12 @@ impl<'a> State<'a> {
     {
         try!(word(&mut self.s, "<"));
         try!(self.print_type(&qself.ty));
-        try!(space(&mut self.s));
-        try!(self.word_space("as"));
-        try!(self.print_path(&path, false, 1));
+        if qself.position > 0 {
+            try!(space(&mut self.s));
+            try!(self.word_space("as"));
+            let depth = path.segments.len() - qself.position;
+            try!(self.print_path(&path, false, depth));
+        }
         try!(word(&mut self.s, ">"));
         try!(word(&mut self.s, "::"));
         let item_segment = path.segments.last().unwrap();