about summary refs log tree commit diff
diff options
context:
space:
mode:
authorAriel Ben-Yehuda <ariel.byd@gmail.com>2015-04-14 21:09:59 +0300
committerAriel Ben-Yehuda <ariel.byd@gmail.com>2015-04-15 22:36:06 +0300
commit6a95d90b86fcfb04377db34324b513f108e4f060 (patch)
tree1926b8c36a63507a8804e57652816bc0c9eb0680
parentce27d024ff16d297ce5e5bfb7cce11810e9c9b5e (diff)
downloadrust-6a95d90b86fcfb04377db34324b513f108e4f060.tar.gz
rust-6a95d90b86fcfb04377db34324b513f108e4f060.zip
make Repr of TraitRef more useful
-rw-r--r--src/librustc/util/ppaux.rs11
1 files changed, 7 insertions, 4 deletions
diff --git a/src/librustc/util/ppaux.rs b/src/librustc/util/ppaux.rs
index 7358b4cc0f6..698f6c47502 100644
--- a/src/librustc/util/ppaux.rs
+++ b/src/librustc/util/ppaux.rs
@@ -810,8 +810,12 @@ impl<'tcx> Repr<'tcx> for ty::TraitRef<'tcx> {
         // to enumerate the `for<...>` etc because the debruijn index
         // tells you everything you need to know.
         let base = ty::item_path_str(tcx, self.def_id);
-        parameterized(tcx, &base, self.substs, self.def_id, &[],
-                      || ty::lookup_trait_def(tcx, self.def_id).generics.clone())
+        let result = parameterized(tcx, &base, self.substs, self.def_id, &[],
+                      || ty::lookup_trait_def(tcx, self.def_id).generics.clone());
+        match self.substs.self_ty() {
+            None => result,
+            Some(sty) => format!("<{} as {}>", sty.repr(tcx), result)
+        }
     }
 }
 
@@ -1504,8 +1508,7 @@ impl<'tcx> UserString<'tcx> for ty::ProjectionPredicate<'tcx> {
 
 impl<'tcx> Repr<'tcx> for ty::ProjectionTy<'tcx> {
     fn repr(&self, tcx: &ctxt<'tcx>) -> String {
-        format!("<{} as {}>::{}",
-                self.trait_ref.substs.self_ty().repr(tcx),
+        format!("{}::{}",
                 self.trait_ref.repr(tcx),
                 self.item_name.repr(tcx))
     }