Skip to content

Commit

Permalink
librustc: DSTify ClassList, LlvmRepr and Repr
Browse files Browse the repository at this point in the history
  • Loading branch information
Jorge Aparicio committed Nov 17, 2014
1 parent daa949e commit d50e80f
Show file tree
Hide file tree
Showing 3 changed files with 9 additions and 9 deletions.
4 changes: 2 additions & 2 deletions src/librustc/middle/trans/cabi_x86_64.rs
Expand Up @@ -61,12 +61,12 @@ impl RegClass {
}
}

trait ClassList {
trait ClassList for Sized? {
fn is_pass_byval(&self) -> bool;
fn is_ret_bysret(&self) -> bool;
}

impl<'a> ClassList for &'a [RegClass] {
impl ClassList for [RegClass] {
fn is_pass_byval(&self) -> bool {
if self.len() == 0 { return false; }

Expand Down
4 changes: 2 additions & 2 deletions src/librustc/middle/trans/llrepr.rs
Expand Up @@ -12,11 +12,11 @@ use middle::trans::context::CrateContext;
use middle::trans::type_::Type;
use llvm::ValueRef;

pub trait LlvmRepr {
pub trait LlvmRepr for Sized? {
fn llrepr(&self, ccx: &CrateContext) -> String;
}

impl<'a, T:LlvmRepr> LlvmRepr for &'a [T] {
impl<T:LlvmRepr> LlvmRepr for [T] {
fn llrepr(&self, ccx: &CrateContext) -> String {
let reprs: Vec<String> = self.iter().map(|t| t.llrepr(ccx)).collect();
format!("[{}]", reprs.connect(","))
Expand Down
10 changes: 5 additions & 5 deletions src/librustc/util/ppaux.rs
Expand Up @@ -37,7 +37,7 @@ use syntax::{ast, ast_util};
use syntax::owned_slice::OwnedSlice;

/// Produces a string suitable for debugging output.
pub trait Repr {
pub trait Repr for Sized? {
fn repr(&self, tcx: &ctxt) -> String;
}

Expand Down Expand Up @@ -578,9 +578,9 @@ impl Repr for () {
}
}

impl<'a,T:Repr> Repr for &'a T {
impl<'a, Sized? T:Repr> Repr for &'a T {
fn repr(&self, tcx: &ctxt) -> String {
(&**self).repr(tcx)
Repr::repr(*self, tcx)
}
}

Expand All @@ -600,9 +600,9 @@ fn repr_vec<T:Repr>(tcx: &ctxt, v: &[T]) -> String {
vec_map_to_string(v, |t| t.repr(tcx))
}

impl<'a, T:Repr> Repr for &'a [T] {
impl<T:Repr> Repr for [T] {
fn repr(&self, tcx: &ctxt) -> String {
repr_vec(tcx, *self)
repr_vec(tcx, self)
}
}

Expand Down

5 comments on commit d50e80f

@bors
Copy link
Contributor

@bors bors commented on d50e80f Nov 18, 2014

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

saw approval from aturon
at japaric@d50e80f

@bors
Copy link
Contributor

@bors bors commented on d50e80f Nov 18, 2014

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

merging japaric/rust/moar-dst = d50e80f into auto

@bors
Copy link
Contributor

@bors bors commented on d50e80f Nov 18, 2014

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

japaric/rust/moar-dst = d50e80f merged ok, testing candidate = f637f1c

@bors
Copy link
Contributor

@bors bors commented on d50e80f Nov 18, 2014

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@bors
Copy link
Contributor

@bors bors commented on d50e80f Nov 18, 2014

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

fast-forwarding master to auto = f637f1c

Please sign in to comment.