Skip to content

Commit d40b7a4

Browse files
committed
---
yaml --- r: 63479 b: refs/heads/snap-stage3 c: c1f037e h: refs/heads/master i: 63477: 8bbcb72 63475: 33448ed 63471: ab7fe74 v: v3
1 parent bbb21b5 commit d40b7a4

8 files changed

+191
-1
lines changed

[refs]

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
---
22
refs/heads/master: 2d28d645422c1617be58c8ca7ad9a457264ca850
33
refs/heads/snap-stage1: e33de59e47c5076a89eadeb38f4934f58a3618a6
4-
refs/heads/snap-stage3: 1496216db6e0ab266df6dcbda31d9fab495afcf9
4+
refs/heads/snap-stage3: c1f037e6ac75e05e6bc3f05ec6cab9de8c971e81
55
refs/heads/try: 7b78b52e602bb3ea8174f9b2006bff3315f03ef9
66
refs/tags/release-0.1: 1f5c5126e96c79d22cb7862f75304136e204f105
77
refs/heads/ndm: f3868061cd7988080c30d6d5bf352a5a5fe2460b
Lines changed: 29 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,29 @@
1+
// Copyright 2013 The Rust Project Developers. See the COPYRIGHT
2+
// file at the top-level directory of this distribution and at
3+
// http://rust-lang.org/COPYRIGHT.
4+
//
5+
// Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or
6+
// http://www.apache.org/licenses/LICENSE-2.0> or the MIT license
7+
// <LICENSE-MIT or http://opensource.org/licenses/MIT>, at your
8+
// option. This file may not be copied, modified, or distributed
9+
// except according to those terms.
10+
11+
// Testing guarantees provided by once functions.
12+
// This program would segfault if it were legal.
13+
14+
extern mod extra;
15+
use extra::arc;
16+
use std::util;
17+
18+
fn foo(blk: ~once fn()) {
19+
blk();
20+
blk(); //~ ERROR use of moved value
21+
}
22+
23+
fn main() {
24+
let x = arc::ARC(true);
25+
do foo {
26+
assert!(*x.get());
27+
util::ignore(x);
28+
}
29+
}
Lines changed: 29 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,29 @@
1+
// Copyright 2013 The Rust Project Developers. See the COPYRIGHT
2+
// file at the top-level directory of this distribution and at
3+
// http://rust-lang.org/COPYRIGHT.
4+
//
5+
// Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or
6+
// http://www.apache.org/licenses/LICENSE-2.0> or the MIT license
7+
// <LICENSE-MIT or http://opensource.org/licenses/MIT>, at your
8+
// option. This file may not be copied, modified, or distributed
9+
// except according to those terms.
10+
11+
// Testing guarantees provided by once functions.
12+
// This program would segfault if it were legal.
13+
14+
extern mod extra;
15+
use extra::arc;
16+
use std::util;
17+
18+
fn foo(blk: &once fn()) {
19+
blk();
20+
blk(); //~ ERROR use of moved value
21+
}
22+
23+
fn main() {
24+
let x = arc::ARC(true);
25+
do foo {
26+
assert!(*x.get());
27+
util::ignore(x);
28+
}
29+
}
Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,20 @@
1+
// Copyright 2013 The Rust Project Developers. See the COPYRIGHT
2+
// file at the top-level directory of this distribution and at
3+
// http://rust-lang.org/COPYRIGHT.
4+
//
5+
// Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or
6+
// http://www.apache.org/licenses/LICENSE-2.0> or the MIT license
7+
// <LICENSE-MIT or http://opensource.org/licenses/MIT>, at your
8+
// option. This file may not be copied, modified, or distributed
9+
// except according to those terms.
10+
11+
// Though it should be legal to copy a heap-allocated "once fn:Copy",
12+
// stack closures are not deep-copied, so (counterintuitively) it should be
13+
// illegal to copy them.
14+
15+
fn foo<'r>(blk: &'r once fn:Copy()) -> (&'r once fn:Copy(), &'r once fn:Copy()) {
16+
(copy blk, blk) //~ ERROR copying a value of non-copyable type
17+
}
18+
19+
fn main() {
20+
}
Lines changed: 29 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,29 @@
1+
// Copyright 2013 The Rust Project Developers. See the COPYRIGHT
2+
// file at the top-level directory of this distribution and at
3+
// http://rust-lang.org/COPYRIGHT.
4+
//
5+
// Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or
6+
// http://www.apache.org/licenses/LICENSE-2.0> or the MIT license
7+
// <LICENSE-MIT or http://opensource.org/licenses/MIT>, at your
8+
// option. This file may not be copied, modified, or distributed
9+
// except according to those terms.
10+
11+
// Testing guarantees provided by once functions.
12+
// This program would segfault if it were legal.
13+
14+
extern mod extra;
15+
use extra::arc;
16+
use std::util;
17+
18+
fn foo(blk: ~fn()) {
19+
blk();
20+
blk();
21+
}
22+
23+
fn main() {
24+
let x = arc::ARC(true);
25+
do foo {
26+
assert!(*x.get());
27+
util::ignore(x); //~ ERROR cannot move out of captured outer variable
28+
}
29+
}
Lines changed: 29 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,29 @@
1+
// Copyright 2013 The Rust Project Developers. See the COPYRIGHT
2+
// file at the top-level directory of this distribution and at
3+
// http://rust-lang.org/COPYRIGHT.
4+
//
5+
// Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or
6+
// http://www.apache.org/licenses/LICENSE-2.0> or the MIT license
7+
// <LICENSE-MIT or http://opensource.org/licenses/MIT>, at your
8+
// option. This file may not be copied, modified, or distributed
9+
// except according to those terms.
10+
11+
// Testing guarantees provided by once functions.
12+
// This program would segfault if it were legal.
13+
14+
extern mod extra;
15+
use extra::arc;
16+
use std::util;
17+
18+
fn foo(blk: &fn()) {
19+
blk();
20+
blk();
21+
}
22+
23+
fn main() {
24+
let x = arc::ARC(true);
25+
do foo {
26+
assert!(*x.get());
27+
util::ignore(x); //~ ERROR cannot move out of captured outer variable
28+
}
29+
}
Lines changed: 27 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,27 @@
1+
// Copyright 2013 The Rust Project Developers. See the COPYRIGHT
2+
// file at the top-level directory of this distribution and at
3+
// http://rust-lang.org/COPYRIGHT.
4+
//
5+
// Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or
6+
// http://www.apache.org/licenses/LICENSE-2.0> or the MIT license
7+
// <LICENSE-MIT or http://opensource.org/licenses/MIT>, at your
8+
// option. This file may not be copied, modified, or distributed
9+
// except according to those terms.
10+
11+
// Testing guarantees provided by once functions.
12+
13+
extern mod extra;
14+
use extra::arc;
15+
use std::util;
16+
17+
fn foo(blk: ~once fn()) {
18+
blk();
19+
}
20+
21+
fn main() {
22+
let x = arc::ARC(true);
23+
do foo {
24+
assert!(*x.get());
25+
util::ignore(x);
26+
}
27+
}
Lines changed: 27 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,27 @@
1+
// Copyright 2013 The Rust Project Developers. See the COPYRIGHT
2+
// file at the top-level directory of this distribution and at
3+
// http://rust-lang.org/COPYRIGHT.
4+
//
5+
// Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or
6+
// http://www.apache.org/licenses/LICENSE-2.0> or the MIT license
7+
// <LICENSE-MIT or http://opensource.org/licenses/MIT>, at your
8+
// option. This file may not be copied, modified, or distributed
9+
// except according to those terms.
10+
11+
// Testing guarantees provided by once functions.
12+
13+
extern mod extra;
14+
use extra::arc;
15+
use std::util;
16+
17+
fn foo(blk: &once fn()) {
18+
blk();
19+
}
20+
21+
fn main() {
22+
let x = arc::ARC(true);
23+
do foo {
24+
assert!(*x.get());
25+
util::ignore(x);
26+
}
27+
}

0 commit comments

Comments
 (0)