mirror of
https://github.com/rust-lang/rust.git
synced 2025-01-24 05:33:41 +00:00
s/moved variable/moved value/
This commit is contained in:
parent
1be4bfb8cc
commit
3bf8b8af98
@ -1662,7 +1662,7 @@ fn check_fn(_fk: visit::fn_kind, _decl: fn_decl,
|
||||
enum ReadKind {
|
||||
PossiblyUninitializedVariable,
|
||||
PossiblyUninitializedField,
|
||||
MovedVariable
|
||||
MovedValue
|
||||
}
|
||||
|
||||
impl @Liveness {
|
||||
@ -1815,7 +1815,7 @@ impl @Liveness {
|
||||
lnk: LiveNodeKind,
|
||||
var: Variable) {
|
||||
|
||||
// the only time that it is possible to have a moved variable
|
||||
// the only time that it is possible to have a moved value
|
||||
// used by ExitNode would be arguments or fields in a ctor.
|
||||
// we give a slightly different error message in those cases.
|
||||
if lnk == ExitNode {
|
||||
@ -1837,7 +1837,7 @@ impl @Liveness {
|
||||
}
|
||||
}
|
||||
|
||||
self.report_illegal_read(move_span, lnk, var, MovedVariable);
|
||||
self.report_illegal_read(move_span, lnk, var, MovedValue);
|
||||
self.tcx.sess.span_note(
|
||||
move_span, ~"move of variable occurred here");
|
||||
|
||||
@ -1852,7 +1852,7 @@ impl @Liveness {
|
||||
~"possibly uninitialized variable"
|
||||
}
|
||||
PossiblyUninitializedField => ~"possibly uninitialized field",
|
||||
MovedVariable => ~"moved variable"
|
||||
MovedValue => ~"moved value"
|
||||
};
|
||||
let name = (*self.ir).variable_name(var);
|
||||
match lnk {
|
||||
|
@ -4,5 +4,5 @@ fn main() {
|
||||
[1, 2, ..move tail] => tail,
|
||||
_ => core::util::unreachable()
|
||||
};
|
||||
a[0] = 0; //~ ERROR: use of moved variable
|
||||
a[0] = 0; //~ ERROR: use of moved value
|
||||
}
|
||||
|
@ -11,5 +11,5 @@
|
||||
fn main() {
|
||||
let x = 5;
|
||||
let _y = fn~(move x) { }; //~ WARNING captured variable `x` not used in closure
|
||||
let _z = x; //~ ERROR use of moved variable: `x`
|
||||
let _z = x; //~ ERROR use of moved value: `x`
|
||||
}
|
||||
|
@ -14,7 +14,7 @@ fn main() {
|
||||
|
||||
let x: int = 25;
|
||||
loop {
|
||||
take(move x); //~ ERROR use of moved variable: `x`
|
||||
take(move x); //~ ERROR use of moved value: `x`
|
||||
//~^ NOTE move of variable occurred here
|
||||
}
|
||||
}
|
||||
|
@ -18,10 +18,10 @@ fn main() {
|
||||
loop {
|
||||
loop {
|
||||
// tjc: Not sure why it prints the same error twice
|
||||
x = move y; //~ ERROR use of moved variable
|
||||
//~^ NOTE move of variable occurred here
|
||||
//~^^ ERROR use of moved variable
|
||||
//~^^^ NOTE move of variable occurred here
|
||||
x = move y; //~ ERROR use of moved value
|
||||
//~^ NOTE move of value occurred here
|
||||
//~^^ ERROR use of moved value
|
||||
//~^^^ NOTE move of value occurred here
|
||||
|
||||
copy x;
|
||||
}
|
||||
|
@ -16,9 +16,9 @@ fn main() {
|
||||
log(debug, y);
|
||||
// tjc: not sure why it prints the same error twice
|
||||
while true { while true { while true { x = move y; copy x; } } }
|
||||
//~^ ERROR use of moved variable: `y`
|
||||
//~^^ NOTE move of variable occurred here
|
||||
//~^^^ ERROR use of moved variable: `y`
|
||||
//~^^^^ NOTE move of variable occurred here
|
||||
//~^ ERROR use of moved value: `y`
|
||||
//~^^ NOTE move of value occurred here
|
||||
//~^^^ ERROR use of moved value: `y`
|
||||
//~^^^^ NOTE move of value occurred here
|
||||
}
|
||||
}
|
||||
|
@ -10,7 +10,7 @@
|
||||
|
||||
fn main() {
|
||||
let x = @5;
|
||||
let y = move x; //~ NOTE move of variable occurred here
|
||||
log(debug, *x); //~ ERROR use of moved variable: `x`
|
||||
let y = move x; //~ NOTE move of value occurred here
|
||||
log(debug, *x); //~ ERROR use of moved value: `x`
|
||||
copy y;
|
||||
}
|
||||
|
@ -19,8 +19,8 @@ enum _chan<T> = int;
|
||||
// Tests that "log(debug, message);" is flagged as using
|
||||
// message after the send deinitializes it
|
||||
fn test00_start(ch: _chan<int>, message: int, _count: int) {
|
||||
send(ch, move message); //~ NOTE move of variable occurred here
|
||||
log(debug, message); //~ ERROR use of moved variable: `message`
|
||||
send(ch, move message); //~ NOTE move of value occurred here
|
||||
log(debug, message); //~ ERROR use of moved value: `message`
|
||||
}
|
||||
|
||||
fn main() { fail; }
|
||||
|
@ -8,7 +8,7 @@
|
||||
// option. This file may not be copied, modified, or distributed
|
||||
// except according to those terms.
|
||||
|
||||
fn dup(x: ~int) -> ~(~int,~int) { ~(x, x) } //~ ERROR use of moved variable
|
||||
fn dup(x: ~int) -> ~(~int,~int) { ~(x, x) } //~ ERROR use of moved value
|
||||
fn main() {
|
||||
dup(~3);
|
||||
}
|
||||
|
@ -3,6 +3,6 @@ fn main() {
|
||||
do task::spawn {
|
||||
io::println(x);
|
||||
}
|
||||
io::println(x); //~ ERROR use of moved variable
|
||||
io::println(x); //~ ERROR use of moved value
|
||||
}
|
||||
|
||||
|
@ -8,7 +8,7 @@
|
||||
// option. This file may not be copied, modified, or distributed
|
||||
// except according to those terms.
|
||||
|
||||
// error-pattern: use of moved variable
|
||||
// error-pattern: use of moved value
|
||||
|
||||
extern mod std;
|
||||
use std::arc;
|
||||
|
@ -16,12 +16,12 @@ fn main() {
|
||||
let v = ~[1, 2, 3, 4, 5, 6, 7, 8, 9, 10];
|
||||
let arc_v = arc::ARC(v);
|
||||
|
||||
do task::spawn() |move arc_v| { //~ NOTE move of variable occurred here
|
||||
do task::spawn() |move arc_v| { //~ NOTE move of value occurred here
|
||||
let v = *arc::get(&arc_v);
|
||||
assert v[3] == 4;
|
||||
};
|
||||
|
||||
assert (*arc::get(&arc_v))[2] == 3; //~ ERROR use of moved variable: `arc_v`
|
||||
assert (*arc::get(&arc_v))[2] == 3; //~ ERROR use of moved value: `arc_v`
|
||||
|
||||
log(info, arc_v);
|
||||
}
|
||||
|
@ -8,7 +8,7 @@
|
||||
// option. This file may not be copied, modified, or distributed
|
||||
// except according to those terms.
|
||||
|
||||
// error-pattern: use of moved variable
|
||||
// error-pattern: use of moved value
|
||||
|
||||
fn main() {
|
||||
let x = 3;
|
||||
|
@ -11,6 +11,6 @@
|
||||
fn main() {
|
||||
let x = ~"Hello!";
|
||||
let _y = x;
|
||||
io::println(x); //~ ERROR use of moved variable
|
||||
io::println(x); //~ ERROR use of moved value
|
||||
}
|
||||
|
||||
|
@ -6,7 +6,7 @@ struct S {
|
||||
impl S {
|
||||
fn foo(self) -> int {
|
||||
self.bar();
|
||||
return self.x; //~ ERROR use of moved variable
|
||||
return self.x; //~ ERROR use of moved value
|
||||
}
|
||||
|
||||
fn bar(self) {}
|
||||
|
@ -5,7 +5,7 @@ struct S {
|
||||
impl S {
|
||||
fn foo(self) -> int {
|
||||
(move self).bar();
|
||||
return self.x; //~ ERROR use of moved variable
|
||||
return self.x; //~ ERROR use of moved value
|
||||
}
|
||||
|
||||
fn bar(self) {}
|
||||
|
Loading…
Reference in New Issue
Block a user