From 82ae2fa93abbdf2b7437e9a8df4b4a18df0bf310 Mon Sep 17 00:00:00 2001 From: Michael Sullivan Date: Mon, 8 Jul 2013 16:54:28 -0700 Subject: [PATCH] Clean up Repr impls a bit so we can add generic impls for @ and ~. --- src/librustc/middle/mem_categorization.rs | 2 +- src/librustc/middle/trans/common.rs | 6 ------ src/librustc/util/ppaux.rs | 18 +++++++----------- 3 files changed, 8 insertions(+), 18 deletions(-) diff --git a/src/librustc/middle/mem_categorization.rs b/src/librustc/middle/mem_categorization.rs index ac7805146e4..f5024f7973c 100644 --- a/src/librustc/middle/mem_categorization.rs +++ b/src/librustc/middle/mem_categorization.rs @@ -1185,7 +1185,7 @@ impl cmt_ { } } -impl Repr for cmt { +impl Repr for cmt_ { fn repr(&self, tcx: ty::ctxt) -> ~str { fmt!("{%s id:%d m:%? ty:%s}", self.cat.repr(tcx), diff --git a/src/librustc/middle/trans/common.rs b/src/librustc/middle/trans/common.rs index 24648ada893..1a45ce36af2 100644 --- a/src/librustc/middle/trans/common.rs +++ b/src/librustc/middle/trans/common.rs @@ -154,12 +154,6 @@ impl Repr for param_substs { } } -impl Repr for @param_substs { - fn repr(&self, tcx: ty::ctxt) -> ~str { - param_substs_to_str(*self, tcx) - } -} - // Function context. Every LLVM function we create will have one of // these. pub struct fn_ctxt_ { diff --git a/src/librustc/util/ppaux.rs b/src/librustc/util/ppaux.rs index 0aae41941cd..005f46057b6 100644 --- a/src/librustc/util/ppaux.rs +++ b/src/librustc/util/ppaux.rs @@ -512,9 +512,6 @@ impl Repr for Option { } } -/* -Annoyingly, these conflict with @ast::expr. - impl Repr for @T { fn repr(&self, tcx: ctxt) -> ~str { (&**self).repr(tcx) @@ -526,7 +523,6 @@ impl Repr for ~T { (&**self).repr(tcx) } } -*/ fn repr_vec(tcx: ctxt, v: &[T]) -> ~str { fmt!("[%s]", v.map(|t| t.repr(tcx)).connect(",")) @@ -538,11 +534,11 @@ impl<'self, T:Repr> Repr for &'self [T] { } } -// This is necessary to handle types like Option<@~[T]>, for which +// This is necessary to handle types like Option<~[T]>, for which // autoderef cannot convert the &[T] handler -impl Repr for @~[T] { +impl Repr for ~[T] { fn repr(&self, tcx: ctxt) -> ~str { - repr_vec(tcx, **self) + repr_vec(tcx, *self) } } @@ -593,19 +589,19 @@ impl Repr for ty::TraitRef { } } -impl Repr for @ast::expr { +impl Repr for ast::expr { fn repr(&self, tcx: ctxt) -> ~str { fmt!("expr(%d: %s)", self.id, - pprust::expr_to_str(*self, tcx.sess.intr())) + pprust::expr_to_str(self, tcx.sess.intr())) } } -impl Repr for @ast::pat { +impl Repr for ast::pat { fn repr(&self, tcx: ctxt) -> ~str { fmt!("pat(%d: %s)", self.id, - pprust::pat_to_str(*self, tcx.sess.intr())) + pprust::pat_to_str(self, tcx.sess.intr())) } }