提交 bede54b1 编写于 作者: N Niko Matsakis

misc. copies in core/syntax to please borrowck

上级 ef32ffd0
......@@ -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();
......
......@@ -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;
}
......
......@@ -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);}
......
......@@ -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 } }
}
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册