misc. copies in core/syntax to please borrowck
This commit is contained in:
parent
ef32ffd0b1
commit
bede54b14a
@ -108,7 +108,7 @@ fn get<A:copy>(future: future<A>) -> A {
|
|||||||
fn with<A,B>(future: future<A>, blk: fn(A) -> B) -> B {
|
fn with<A,B>(future: future<A>, blk: fn(A) -> B) -> B {
|
||||||
#[doc = "Work with the value without copying it"];
|
#[doc = "Work with the value without copying it"];
|
||||||
|
|
||||||
let v = alt future.v {
|
let v = alt copy future.v {
|
||||||
either::left(v) { v }
|
either::left(v) { v }
|
||||||
either::right(f) {
|
either::right(f) {
|
||||||
let v = @f();
|
let v = @f();
|
||||||
|
@ -613,7 +613,7 @@ impl of writer for mem_buffer {
|
|||||||
// FIXME #2004--use memcpy here?
|
// FIXME #2004--use memcpy here?
|
||||||
let mut pos = self.pos, vpos = 0u;
|
let mut pos = self.pos, vpos = 0u;
|
||||||
while vpos < vlen && pos < buf_len {
|
while vpos < vlen && pos < buf_len {
|
||||||
self.buf.set_elt(pos, v[vpos]);
|
self.buf.set_elt(pos, copy v[vpos]);
|
||||||
pos += 1u;
|
pos += 1u;
|
||||||
vpos += 1u;
|
vpos += 1u;
|
||||||
}
|
}
|
||||||
|
@ -212,7 +212,7 @@ fn finish<T: qq_helper>
|
|||||||
state = skip(str::char_len(repl));
|
state = skip(str::char_len(repl));
|
||||||
str2 += repl;
|
str2 += repl;
|
||||||
}
|
}
|
||||||
alt state {
|
alt copy state {
|
||||||
active {str::push_char(str2, ch);}
|
active {str::push_char(str2, ch);}
|
||||||
skip(1u) {state = blank;}
|
skip(1u) {state = blank;}
|
||||||
skip(sk) {state = skip (sk-1u);}
|
skip(sk) {state = skip (sk-1u);}
|
||||||
|
@ -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; } _ { } }
|
alt t { token::IDENT(_, _) { ret true; } _ { } }
|
||||||
ret false;
|
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 } };
|
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 } }
|
alt t { token::BINOP(token::OR) | token::OROR { true } _ { false } }
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user