Skip to content

Commit 5ba0196

Browse files
committed
misc ppaux changes
1 parent 688ddf7 commit 5ba0196

File tree

1 file changed

+20
-11
lines changed

1 file changed

+20
-11
lines changed

src/librustc/util/ppaux.rs

+20-11
Original file line numberDiff line numberDiff line change
@@ -496,7 +496,13 @@ pub fn parameterized(cx: &ctxt,
496496

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

@@ -539,15 +545,15 @@ impl Repr for () {
539545
}
540546
}
541547

542-
impl<T:Repr> Repr for Rc<T> {
548+
impl<'a,T:Repr> Repr for &'a T {
543549
fn repr(&self, tcx: &ctxt) -> String {
544550
(&**self).repr(tcx)
545551
}
546552
}
547553

548-
impl<'a, T:Repr> Repr for &'a T {
554+
impl<T:Repr> Repr for Rc<T> {
549555
fn repr(&self, tcx: &ctxt) -> String {
550-
(*self).repr(tcx)
556+
(&**self).repr(tcx)
551557
}
552558
}
553559

@@ -690,7 +696,11 @@ impl Repr for ty::ParamBounds {
690696

691697
impl Repr for ty::TraitRef {
692698
fn repr(&self, tcx: &ctxt) -> String {
693-
trait_ref_to_string(tcx, self)
699+
let base = ty::item_path_str(tcx, self.def_id);
700+
let trait_def = ty::lookup_trait_def(tcx, self.def_id);
701+
format!("<{} as {}>",
702+
self.substs.self_ty().repr(tcx),
703+
parameterized(tcx, base.as_slice(), &self.substs, &trait_def.generics))
694704
}
695705
}
696706

@@ -962,18 +972,16 @@ impl Repr for typeck::MethodOrigin {
962972

963973
impl Repr for typeck::MethodParam {
964974
fn repr(&self, tcx: &ctxt) -> String {
965-
format!("MethodParam({},{:?},{:?},{:?})",
966-
self.trait_id.repr(tcx),
967-
self.method_num,
968-
self.param_num,
969-
self.bound_num)
975+
format!("MethodParam({},{})",
976+
self.trait_ref.repr(tcx),
977+
self.method_num)
970978
}
971979
}
972980

973981
impl Repr for typeck::MethodObject {
974982
fn repr(&self, tcx: &ctxt) -> String {
975983
format!("MethodObject({},{:?},{:?})",
976-
self.trait_id.repr(tcx),
984+
self.trait_ref.repr(tcx),
977985
self.method_num,
978986
self.real_index)
979987
}
@@ -1231,3 +1239,4 @@ impl<A:Repr,B:Repr> Repr for (A,B) {
12311239
format!("({},{})", a.repr(tcx), b.repr(tcx))
12321240
}
12331241
}
1242+

0 commit comments

Comments
 (0)