mirror of
https://github.com/rust-lang/rust.git
synced 2026-05-21 17:52:12 +03:00
Clean up Repr impls a bit so we can add generic impls for @ and ~.
This commit is contained in:
@@ -1185,7 +1185,7 @@ pub fn freely_aliasable(&self) -> Option<AliasableReason> {
|
||||
}
|
||||
}
|
||||
|
||||
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),
|
||||
|
||||
@@ -154,12 +154,6 @@ fn repr(&self, tcx: ty::ctxt) -> ~str {
|
||||
}
|
||||
}
|
||||
|
||||
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_ {
|
||||
|
||||
@@ -512,9 +512,6 @@ fn repr(&self, tcx: ctxt) -> ~str {
|
||||
}
|
||||
}
|
||||
|
||||
/*
|
||||
Annoyingly, these conflict with @ast::expr.
|
||||
|
||||
impl<T:Repr> Repr for @T {
|
||||
fn repr(&self, tcx: ctxt) -> ~str {
|
||||
(&**self).repr(tcx)
|
||||
@@ -526,7 +523,6 @@ fn repr(&self, tcx: ctxt) -> ~str {
|
||||
(&**self).repr(tcx)
|
||||
}
|
||||
}
|
||||
*/
|
||||
|
||||
fn repr_vec<T:Repr>(tcx: ctxt, v: &[T]) -> ~str {
|
||||
fmt!("[%s]", v.map(|t| t.repr(tcx)).connect(","))
|
||||
@@ -538,11 +534,11 @@ fn repr(&self, tcx: ctxt) -> ~str {
|
||||
}
|
||||
}
|
||||
|
||||
// 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<T:Repr> Repr for @~[T] {
|
||||
impl<T:Repr> Repr for ~[T] {
|
||||
fn repr(&self, tcx: ctxt) -> ~str {
|
||||
repr_vec(tcx, **self)
|
||||
repr_vec(tcx, *self)
|
||||
}
|
||||
}
|
||||
|
||||
@@ -593,19 +589,19 @@ fn repr(&self, tcx: ctxt) -> ~str {
|
||||
}
|
||||
}
|
||||
|
||||
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()))
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user