diff --git a/src/rustc/middle/borrowck.rs b/src/rustc/middle/borrowck.rs index 38559aec28d..eb78e46f273 100644 --- a/src/rustc/middle/borrowck.rs +++ b/src/rustc/middle/borrowck.rs @@ -467,7 +467,9 @@ impl to_str_methods for borrowck_ctxt { cat_special(sk_method) { "method" } cat_special(sk_static_item) { "static item" } cat_special(sk_self) { "self reference" } - cat_special(sk_heap_upvar) { "variable declared in an outer block" } + cat_special(sk_heap_upvar) { + "captured outer variable in a heap closure" + } cat_rvalue { "non-lvalue" } cat_local(_) { mut_str + " local variable" } cat_binding(_) { "pattern binding" } @@ -475,7 +477,7 @@ impl to_str_methods for borrowck_ctxt { cat_deref(_, _, pk) { #fmt["dereference of %s %s pointer", mut_str, self.pk_to_sigil(pk)] } cat_stack_upvar(_) { - mut_str + " variable declared in an outer block" + "captured outer " + mut_str + " variable in a stack closure" } cat_comp(_, comp_field(*)) { mut_str + " field" } cat_comp(_, comp_tuple) { "tuple content" } diff --git a/src/test/compile-fail/block-deinitializes-upvar.rs b/src/test/compile-fail/block-deinitializes-upvar.rs index 679e3c4797b..cfcf2bffb34 100644 --- a/src/test/compile-fail/block-deinitializes-upvar.rs +++ b/src/test/compile-fail/block-deinitializes-upvar.rs @@ -1,4 +1,4 @@ -// error-pattern:moving out of immutable variable declared in an outer block +// error-pattern:moving out of captured outer immutable variable in a stack closure fn force(f: fn()) { f(); } fn main() { let mut x = @{x: 17, y: 2}; diff --git a/src/test/compile-fail/borrowck-lend-flow.rs b/src/test/compile-fail/borrowck-lend-flow.rs index 7b050275b43..9a0af32e78b 100644 --- a/src/test/compile-fail/borrowck-lend-flow.rs +++ b/src/test/compile-fail/borrowck-lend-flow.rs @@ -63,7 +63,7 @@ fn loop_in_block() { let mut v = ~3, w = ~4; let mut _x = &mut w; for uint::range(0u, 10u) |_i| { - borrow(v); //~ ERROR loan of mutable variable declared in an outer block as immutable conflicts with prior loan + borrow(v); //~ ERROR loan of captured outer mutable variable in a stack closure as immutable conflicts with prior loan _x = &mut v; //~ NOTE prior loan as mutable granted here } } @@ -77,7 +77,7 @@ fn at_most_once_block() { let mut v = ~3, w = ~4; let mut _x = &mut w; do at_most_once { - borrow(v); //~ ERROR loan of mutable variable declared in an outer block as immutable conflicts with prior loan + borrow(v); //~ ERROR loan of captured outer mutable variable in a stack closure as immutable conflicts with prior loan _x = &mut v; //~ NOTE prior loan as mutable granted here } } diff --git a/src/test/compile-fail/borrowck-loan-blocks-mut-uniq.rs b/src/test/compile-fail/borrowck-loan-blocks-mut-uniq.rs index ad9eb9c4874..2483c3e24f6 100644 --- a/src/test/compile-fail/borrowck-loan-blocks-mut-uniq.rs +++ b/src/test/compile-fail/borrowck-loan-blocks-mut-uniq.rs @@ -5,7 +5,7 @@ fn borrow(v: &int, f: fn(x: &int)) { fn box_imm() { let mut v = ~3; do borrow(v) |w| { //~ NOTE loan of mutable local variable granted here - v = ~4; //~ ERROR assigning to mutable variable declared in an outer block prohibited due to outstanding loan + v = ~4; //~ ERROR assigning to captured outer mutable variable in a stack closure prohibited due to outstanding loan assert *v == 3; assert *w == 4; } diff --git a/src/test/compile-fail/cap-clause-move-upvar.rs b/src/test/compile-fail/cap-clause-move-upvar.rs index c070c80edf9..6fd57cd09e2 100644 --- a/src/test/compile-fail/cap-clause-move-upvar.rs +++ b/src/test/compile-fail/cap-clause-move-upvar.rs @@ -1,7 +1,7 @@ fn main() { let x = 5; let _y = fn~(move x) -> int { - let _z = fn~(move x) -> int { x }; //~ ERROR moving out of variable declared in an outer block + let _z = fn~(move x) -> int { x }; //~ ERROR moving out of captured outer variable in a heap closure 22 }; } diff --git a/src/test/compile-fail/issue-1965.rs b/src/test/compile-fail/issue-1965.rs index b5e68b51ed4..9742acba1e3 100644 --- a/src/test/compile-fail/issue-1965.rs +++ b/src/test/compile-fail/issue-1965.rs @@ -1,4 +1,4 @@ -// error-pattern:moving out of immutable variable declared in an outer block +// error-pattern:moving out of captured outer immutable variable in a stack closure fn test(-x: uint) {} fn main() { diff --git a/src/test/compile-fail/lambda-mutate-nested.rs b/src/test/compile-fail/lambda-mutate-nested.rs index 944282a4deb..8b673e2b307 100644 --- a/src/test/compile-fail/lambda-mutate-nested.rs +++ b/src/test/compile-fail/lambda-mutate-nested.rs @@ -1,4 +1,4 @@ -// error-pattern:assigning to immutable variable declared in an outer block +// error-pattern:assigning to captured outer immutable variable in a stack closure // Make sure that nesting a block within a fn@ doesn't let us // mutate upvars from a fn@. fn f2(x: fn()) { x(); } diff --git a/src/test/compile-fail/lambda-mutate.rs b/src/test/compile-fail/lambda-mutate.rs index ce36ac7b127..8886f930e20 100644 --- a/src/test/compile-fail/lambda-mutate.rs +++ b/src/test/compile-fail/lambda-mutate.rs @@ -1,4 +1,4 @@ -// error-pattern:assigning to variable declared in an outer block +// error-pattern:assigning to captured outer variable in a heap closure // Make sure we can't write to upvars from fn@s fn main() { let i = 0;