1
Fork 0

librustc: Implement explicit self for Add and Index; add a hack in the borrow checker to support this. r=nmatsakis

This commit is contained in:
Patrick Walton 2012-11-28 13:51:50 -08:00
parent 56ece46f7d
commit d1ebdbeb6c
10 changed files with 128 additions and 15 deletions

View file

@ -2107,12 +2107,21 @@ impl ~str: Trimmable {
#[cfg(notest)]
pub mod traits {
#[cfg(stage0)]
impl ~str : Add<&str,~str> {
#[inline(always)]
pure fn add(rhs: & &self/str) -> ~str {
append(copy self, (*rhs))
}
}
#[cfg(stage1)]
#[cfg(stage2)]
impl ~str : Add<&str,~str> {
#[inline(always)]
pure fn add(&self, rhs: & &self/str) -> ~str {
append(copy *self, (*rhs))
}
}
}
#[cfg(test)]