misc. copies in core/syntax to please borrowck

This commit is contained in:
Niko Matsakis 2012-06-02 20:48:53 -07:00
parent ef32ffd0b1
commit bede54b14a
4 changed files with 6 additions and 6 deletions

View File

@ -108,7 +108,7 @@ fn get<A:copy>(future: future<A>) -> A {
fn with<A,B>(future: future<A>, blk: fn(A) -> B) -> B {
#[doc = "Work with the value without copying it"];
let v = alt future.v {
let v = alt copy future.v {
either::left(v) { v }
either::right(f) {
let v = @f();

View File

@ -613,7 +613,7 @@ fn write(v: [const u8]/&) {
// FIXME #2004--use memcpy here?
let mut pos = self.pos, vpos = 0u;
while vpos < vlen && pos < buf_len {
self.buf.set_elt(pos, v[vpos]);
self.buf.set_elt(pos, copy v[vpos]);
pos += 1u;
vpos += 1u;
}

View File

@ -212,7 +212,7 @@ fn finish<T: qq_helper>
state = skip(str::char_len(repl));
str2 += repl;
}
alt state {
alt copy state {
active {str::push_char(str2, ch);}
skip(1u) {state = blank;}
skip(sk) {state = skip (sk-1u);}

View File

@ -184,16 +184,16 @@ fn is_lit(t: token::token) -> bool {
}
}
fn is_ident(t: token::token) -> bool {
pure fn is_ident(t: token::token) -> bool {
alt t { token::IDENT(_, _) { ret true; } _ { } }
ret false;
}
fn is_plain_ident(t: token::token) -> bool {
pure fn is_plain_ident(t: token::token) -> bool {
ret alt t { token::IDENT(_, false) { true } _ { false } };
}
fn is_bar(t: token::token) -> bool {
pure fn is_bar(t: token::token) -> bool {
alt t { token::BINOP(token::OR) | token::OROR { true } _ { false } }
}