avoid broken += operator, bogus use of const

This commit is contained in:
Niko Matsakis 2013-05-01 10:31:10 -04:00
parent 4af2d90af5
commit 3159335ac3
3 changed files with 10 additions and 10 deletions

View File

@ -23,7 +23,7 @@ impl<'self> MyIter for &'self [int] {
impl<'self> MyIter for &'self str {
fn test_imm(&self) { assert_eq!(*self, "test") }
fn test_const(&const self) { assert_eq!(self[0], 't') }
fn test_const(&const self) { assert_eq!(self[0], 't' as u8) }
}
pub fn main() {

View File

@ -17,5 +17,5 @@ struct Refs { refs: ~[int], n: int }
pub fn main() {
let e = @mut Refs{refs: ~[], n: 0};
let f: @fn() = || error!(copy e.n);
e.refs += ~[1];
e.refs.push(1);
}

View File

@ -513,16 +513,16 @@ impl TyVisitor for my_visitor {
fn visit_bot(&self) -> bool { true }
fn visit_nil(&self) -> bool { true }
fn visit_bool(&self) -> bool {
do self.get::<bool>() |b| {
self.vals += ~[bool::to_str(b)];
};
true
do self.get::<bool>() |b| {
self.vals.push(bool::to_str(b));
};
true
}
fn visit_int(&self) -> bool {
do self.get::<int>() |i| {
self.vals += ~[int::to_str(i)];
};
true
do self.get::<int>() |i| {
self.vals.push(int::to_str(i));
};
true
}
fn visit_i8(&self) -> bool { true }
fn visit_i16(&self) -> bool { true }