Skip to content

Commit 82ae2fa

Browse files
committed
Clean up Repr impls a bit so we can add generic impls for @ and ~.
1 parent 38dc832 commit 82ae2fa

File tree

3 files changed

+8
-18
lines changed

3 files changed

+8
-18
lines changed

src/librustc/middle/mem_categorization.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1185,7 +1185,7 @@ impl cmt_ {
11851185
}
11861186
}
11871187

1188-
impl Repr for cmt {
1188+
impl Repr for cmt_ {
11891189
fn repr(&self, tcx: ty::ctxt) -> ~str {
11901190
fmt!("{%s id:%d m:%? ty:%s}",
11911191
self.cat.repr(tcx),

src/librustc/middle/trans/common.rs

Lines changed: 0 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -154,12 +154,6 @@ impl Repr for param_substs {
154154
}
155155
}
156156

157-
impl Repr for @param_substs {
158-
fn repr(&self, tcx: ty::ctxt) -> ~str {
159-
param_substs_to_str(*self, tcx)
160-
}
161-
}
162-
163157
// Function context. Every LLVM function we create will have one of
164158
// these.
165159
pub struct fn_ctxt_ {

src/librustc/util/ppaux.rs

Lines changed: 7 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -512,9 +512,6 @@ impl<T:Repr> Repr for Option<T> {
512512
}
513513
}
514514

515-
/*
516-
Annoyingly, these conflict with @ast::expr.
517-
518515
impl<T:Repr> Repr for @T {
519516
fn repr(&self, tcx: ctxt) -> ~str {
520517
(&**self).repr(tcx)
@@ -526,7 +523,6 @@ impl<T:Repr> Repr for ~T {
526523
(&**self).repr(tcx)
527524
}
528525
}
529-
*/
530526

531527
fn repr_vec<T:Repr>(tcx: ctxt, v: &[T]) -> ~str {
532528
fmt!("[%s]", v.map(|t| t.repr(tcx)).connect(","))
@@ -538,11 +534,11 @@ impl<'self, T:Repr> Repr for &'self [T] {
538534
}
539535
}
540536

541-
// This is necessary to handle types like Option<@~[T]>, for which
537+
// This is necessary to handle types like Option<~[T]>, for which
542538
// autoderef cannot convert the &[T] handler
543-
impl<T:Repr> Repr for @~[T] {
539+
impl<T:Repr> Repr for ~[T] {
544540
fn repr(&self, tcx: ctxt) -> ~str {
545-
repr_vec(tcx, **self)
541+
repr_vec(tcx, *self)
546542
}
547543
}
548544

@@ -593,19 +589,19 @@ impl Repr for ty::TraitRef {
593589
}
594590
}
595591

596-
impl Repr for @ast::expr {
592+
impl Repr for ast::expr {
597593
fn repr(&self, tcx: ctxt) -> ~str {
598594
fmt!("expr(%d: %s)",
599595
self.id,
600-
pprust::expr_to_str(*self, tcx.sess.intr()))
596+
pprust::expr_to_str(self, tcx.sess.intr()))
601597
}
602598
}
603599

604-
impl Repr for @ast::pat {
600+
impl Repr for ast::pat {
605601
fn repr(&self, tcx: ctxt) -> ~str {
606602
fmt!("pat(%d: %s)",
607603
self.id,
608-
pprust::pat_to_str(*self, tcx.sess.intr()))
604+
pprust::pat_to_str(self, tcx.sess.intr()))
609605
}
610606
}
611607

0 commit comments

Comments
 (0)