diff options
| author | Brian Anderson <banderson@mozilla.com> | 2012-12-13 19:06:27 -0800 |
|---|---|---|
| committer | Brian Anderson <banderson@mozilla.com> | 2012-12-13 19:06:27 -0800 |
| commit | b07a78b7cbf2d491b616c0a7bbf7f1b0611e4655 (patch) | |
| tree | 966029b63dc302afcde8362b8cb96dba5df232fc /src/test/compile-fail | |
| parent | 9677fff0f9327915b62e4f251d3ad95d2912240d (diff) | |
| download | rust-b07a78b7cbf2d491b616c0a7bbf7f1b0611e4655.tar.gz rust-b07a78b7cbf2d491b616c0a7bbf7f1b0611e4655.zip | |
Fix broken tests
Diffstat (limited to 'src/test/compile-fail')
| -rw-r--r-- | src/test/compile-fail/block-arg-used-as-lambda-with-illegal-cap.rs | 2 | ||||
| -rw-r--r-- | src/test/compile-fail/copy-into-closure.rs | 29 | ||||
| -rw-r--r-- | src/test/compile-fail/issue-2487-b.rs | 32 | ||||
| -rw-r--r-- | src/test/compile-fail/issue-2828.rs | 31 | ||||
| -rw-r--r-- | src/test/compile-fail/no-capture-arc.rs | 2 |
5 files changed, 7 insertions, 89 deletions
diff --git a/src/test/compile-fail/block-arg-used-as-lambda-with-illegal-cap.rs b/src/test/compile-fail/block-arg-used-as-lambda-with-illegal-cap.rs index 14064ad97a6..97520c0a44c 100644 --- a/src/test/compile-fail/block-arg-used-as-lambda-with-illegal-cap.rs +++ b/src/test/compile-fail/block-arg-used-as-lambda-with-illegal-cap.rs @@ -13,7 +13,7 @@ fn to_lambda1(f: fn@(uint) -> uint) -> fn@(uint) -> uint { } fn to_lambda2(b: fn(uint) -> uint) -> fn@(uint) -> uint { - return to_lambda1({|x| b(x)}); //~ ERROR value may contain borrowed pointers + return to_lambda1({|x| b(x)}); //~ ERROR illegal move from argument `b` } fn main() { diff --git a/src/test/compile-fail/copy-into-closure.rs b/src/test/compile-fail/copy-into-closure.rs index 2ad0b26ba33..bb96db8c41c 100644 --- a/src/test/compile-fail/copy-into-closure.rs +++ b/src/test/compile-fail/copy-into-closure.rs @@ -8,42 +8,23 @@ // option. This file may not be copied, modified, or distributed // except according to those terms. -fn closure1(+x: ~str) -> (~str, fn@() -> ~str) { - let f = fn@() -> ~str { - copy x - //~^ WARNING implicitly copying a non-implicitly-copyable value - //~^^ NOTE to copy values into a @fn closure, use a capture clause - }; - (move x,f) -} - fn closure2(+x: util::NonCopyable) -> (util::NonCopyable, fn@() -> util::NonCopyable) { - let f = fn@() -> util::NonCopyable { - copy x + let f = fn@(copy x) -> util::NonCopyable { //~^ ERROR copying a noncopyable value //~^^ NOTE non-copyable value cannot be copied into a @fn closure - //~^^^ ERROR copying a noncopyable value + copy x + //~^ ERROR copying a noncopyable value }; (move x,f) } fn closure3(+x: util::NonCopyable) { - do task::spawn { - let s = copy x; + do task::spawn |copy x| { //~^ ERROR copying a noncopyable value //~^^ NOTE non-copyable value cannot be copied into a ~fn closure - //~^^^ ERROR copying a noncopyable value - error!("%?", s); + error!("%?", x); } error!("%?", x); } fn main() { - let x = ~"hello"; - do task::spawn { - let s = copy x; - //~^ WARNING implicitly copying a non-implicitly-copyable value - //~^^ NOTE to copy values into a ~fn closure, use a capture clause - error!("%s from child", s); - } - error!("%s", x); } diff --git a/src/test/compile-fail/issue-2487-b.rs b/src/test/compile-fail/issue-2487-b.rs deleted file mode 100644 index 0b35a08a2b2..00000000000 --- a/src/test/compile-fail/issue-2487-b.rs +++ /dev/null @@ -1,32 +0,0 @@ -// Copyright 2012 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or -// http://www.apache.org/licenses/LICENSE-2.0> or the MIT license -// <LICENSE-MIT or http://opensource.org/licenses/MIT>, at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - -struct socket { - sock: int, -} - -impl socket : Drop { - fn finalize(&self) {} -} - -impl socket { - - fn set_identity() { - do closure { - setsockopt_bytes(self.sock) //~ ERROR copying a noncopyable value - } - } -} - -fn closure(f: fn@()) { f() } - -fn setsockopt_bytes(+_sock: int) { } - -fn main() {} diff --git a/src/test/compile-fail/issue-2828.rs b/src/test/compile-fail/issue-2828.rs deleted file mode 100644 index 36fa1f9dc18..00000000000 --- a/src/test/compile-fail/issue-2828.rs +++ /dev/null @@ -1,31 +0,0 @@ -// Copyright 2012 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or -// http://www.apache.org/licenses/LICENSE-2.0> or the MIT license -// <LICENSE-MIT or http://opensource.org/licenses/MIT>, at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - -struct NoCopy { - n: int -} -fn NoCopy() -> NoCopy { - NoCopy { n: 0 } -} - -impl NoCopy: Drop { - fn finalize(&self) { - log(error, "running destructor"); - } -} - -fn main() { - let x = NoCopy(); - - let f = fn~() { assert x.n == 0; }; //~ ERROR copying a noncopyable value - let g = copy f; - - f(); g(); -} \ No newline at end of file diff --git a/src/test/compile-fail/no-capture-arc.rs b/src/test/compile-fail/no-capture-arc.rs index 57a20e7e90c..6143e869988 100644 --- a/src/test/compile-fail/no-capture-arc.rs +++ b/src/test/compile-fail/no-capture-arc.rs @@ -8,7 +8,7 @@ // option. This file may not be copied, modified, or distributed // except according to those terms. -// error-pattern: copying a noncopyable value +// error-pattern: use of moved variable extern mod std; use std::arc; |
