Skip to content

Commit 6b2da35

Browse files
committed
misc ppaux changes
1 parent 3376ede commit 6b2da35

File tree

1 file changed

+23
-8
lines changed

1 file changed

+23
-8
lines changed

src/librustc/util/ppaux.rs

Lines changed: 23 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -497,7 +497,13 @@ pub fn parameterized(cx: &ctxt,
497497

498498
if cx.sess.verbose() {
499499
for t in substs.types.get_slice(subst::SelfSpace).iter() {
500-
strs.push(format!("for {}", t.repr(cx)));
500+
strs.push(format!("self {}", t.repr(cx)));
501+
}
502+
503+
// generally there shouldn't be any substs in the fn param
504+
// space, but in verbose mode, print them out.
505+
for t in substs.types.get_slice(subst::FnSpace).iter() {
506+
strs.push(format!("fn {}", t.repr(cx)));
501507
}
502508
}
503509

@@ -540,6 +546,12 @@ impl Repr for () {
540546
}
541547
}
542548

549+
impl<'a,T:Repr> Repr for &'a T {
550+
fn repr(&self, tcx: &ctxt) -> String {
551+
(&**self).repr(tcx)
552+
}
553+
}
554+
543555
impl<T:Repr> Repr for Rc<T> {
544556
fn repr(&self, tcx: &ctxt) -> String {
545557
(&**self).repr(tcx)
@@ -691,7 +703,11 @@ impl Repr for ty::ParamBounds {
691703

692704
impl Repr for ty::TraitRef {
693705
fn repr(&self, tcx: &ctxt) -> String {
694-
trait_ref_to_string(tcx, self)
706+
let base = ty::item_path_str(tcx, self.def_id);
707+
let trait_def = ty::lookup_trait_def(tcx, self.def_id);
708+
format!("<{} as {}>",
709+
self.substs.self_ty().repr(tcx),
710+
parameterized(tcx, base.as_slice(), &self.substs, &trait_def.generics))
695711
}
696712
}
697713

@@ -965,18 +981,16 @@ impl Repr for typeck::MethodOrigin {
965981

966982
impl Repr for typeck::MethodParam {
967983
fn repr(&self, tcx: &ctxt) -> String {
968-
format!("MethodParam({},{:?},{:?},{:?})",
969-
self.trait_id.repr(tcx),
970-
self.method_num,
971-
self.param_num,
972-
self.bound_num)
984+
format!("MethodParam({},{})",
985+
self.trait_ref.repr(tcx),
986+
self.method_num)
973987
}
974988
}
975989

976990
impl Repr for typeck::MethodObject {
977991
fn repr(&self, tcx: &ctxt) -> String {
978992
format!("MethodObject({},{:?},{:?})",
979-
self.trait_id.repr(tcx),
993+
self.trait_ref.repr(tcx),
980994
self.method_num,
981995
self.real_index)
982996
}
@@ -1234,3 +1248,4 @@ impl<A:Repr,B:Repr> Repr for (A,B) {
12341248
format!("({},{})", a.repr(tcx), b.repr(tcx))
12351249
}
12361250
}
1251+

0 commit comments

Comments
 (0)