Skip to content

Commit f39957b

Browse files
bstriebrson
authored andcommitted
---
yaml --- r: 40385 b: refs/heads/dist-snap c: f4a5a76 h: refs/heads/master i: 40383: 300d22f v: v3
1 parent be78c99 commit f39957b

File tree

76 files changed

+463
-162
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

76 files changed

+463
-162
lines changed

[refs]

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@ refs/tags/release-0.1: 1f5c5126e96c79d22cb7862f75304136e204f105
77
refs/heads/ndm: f3868061cd7988080c30d6d5bf352a5a5fe2460b
88
refs/heads/try2: a810c03263670238bccd64cabb12a23a46e3a278
99
refs/heads/incoming: e90142e536c150df0d9b4b2f11352152177509b5
10-
refs/heads/dist-snap: 6e650f2d2c83a191a0546b394a87ba348934db4f
10+
refs/heads/dist-snap: f4a5a76aa4596b3892dced83e3e2bea082e20c48
1111
refs/tags/release-0.2: c870d2dffb391e14efb05aa27898f1f6333a9596
1212
refs/tags/release-0.3: b5f0d0f648d9a6153664837026ba1be43d3e2503
1313
refs/heads/try3: 9387340aab40a73e8424c48fd42f0c521a4875c0

branches/dist-snap/src/test/auxiliary/issue-2526.rs

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,10 @@ export context;
99

1010
struct arc_destruct<T:Const> {
1111
_data: int,
12-
drop {}
12+
}
13+
14+
impl<T:Const> arc_destruct<T> : Drop {
15+
fn finalize() {}
1316
}
1417

1518
fn arc_destruct<T: Const>(data: int) -> arc_destruct<T> {
@@ -28,8 +31,10 @@ fn init() -> arc_destruct<context_res> unsafe {
2831

2932
struct context_res {
3033
ctx : int,
34+
}
3135

32-
drop { }
36+
impl context_res : Drop {
37+
fn finalize() {}
3338
}
3439

3540
fn context_res() -> context_res {

branches/dist-snap/src/test/auxiliary/issue-3012-1.rs

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,12 @@ export socket_handle;
99

1010
struct socket_handle {
1111
sockfd: libc::c_int,
12-
drop { /* c::close(self.sockfd); */ }
12+
}
13+
14+
impl socket_handle : Drop {
15+
fn finalize() {
16+
/* c::close(self.sockfd); */
17+
}
1318
}
1419

1520
fn socket_handle(x: libc::c_int) -> socket_handle {

branches/dist-snap/src/test/auxiliary/issue2170lib.rs

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -5,11 +5,16 @@ fn foo(_x: i32) {
55

66
struct rsrc {
77
x: i32,
8-
drop { foo(self.x); }
8+
}
9+
10+
impl rsrc : Drop {
11+
fn finalize() {
12+
foo(self.x);
13+
}
914
}
1015

1116
fn rsrc(x: i32) -> rsrc {
1217
rsrc {
1318
x: x
1419
}
15-
}
20+
}

branches/dist-snap/src/test/auxiliary/test_comm.rs

Lines changed: 19 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -29,23 +29,28 @@ fn port<T: Send>() -> port<T> {
2929

3030
struct port_ptr<T:Send> {
3131
po: *rust_port,
32-
drop unsafe {
33-
debug!("in the port_ptr destructor");
34-
do task::unkillable {
35-
let yield = 0u;
36-
let yieldp = ptr::addr_of(&yield);
37-
rustrt::rust_port_begin_detach(self.po, yieldp);
38-
if yield != 0u {
39-
task::yield();
40-
}
41-
rustrt::rust_port_end_detach(self.po);
32+
}
4233

43-
while rustrt::rust_port_size(self.po) > 0u as size_t {
44-
recv_::<T>(self.po);
34+
impl<T:Send> port_ptr<T> : Drop {
35+
fn finalize() {
36+
unsafe {
37+
debug!("in the port_ptr destructor");
38+
do task::unkillable {
39+
let yield = 0u;
40+
let yieldp = ptr::addr_of(&yield);
41+
rustrt::rust_port_begin_detach(self.po, yieldp);
42+
if yield != 0u {
43+
task::yield();
44+
}
45+
rustrt::rust_port_end_detach(self.po);
46+
47+
while rustrt::rust_port_size(self.po) > 0u as size_t {
48+
recv_::<T>(self.po);
49+
}
50+
rustrt::del_port(self.po);
51+
}
4552
}
46-
rustrt::del_port(self.po);
4753
}
48-
}
4954
}
5055

5156
fn port_ptr<T: Send>(po: *rust_port) -> port_ptr<T> {

branches/dist-snap/src/test/bench/task-perf-alloc-unwind.rs

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -42,7 +42,10 @@ enum st {
4242

4343
struct r {
4444
_l: @nillist,
45-
drop {}
45+
}
46+
47+
impl r : Drop {
48+
fn finalize() {}
4649
}
4750

4851
fn r(l: @nillist) -> r {

branches/dist-snap/src/test/compile-fail/bind-by-move-neither-can-live-while-the-other-survives-1.rs

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,10 @@
1-
struct X { x: (), drop { error!("destructor runs"); } }
1+
struct X { x: () }
2+
3+
impl X : Drop {
4+
fn finalize() {
5+
error!("destructor runs");
6+
}
7+
}
28

39
fn main() {
410
let x = Some(X { x: () });

branches/dist-snap/src/test/compile-fail/bind-by-move-neither-can-live-while-the-other-survives-2.rs

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,10 @@
1-
struct X { x: (), drop { error!("destructor runs"); } }
1+
struct X { x: (), }
2+
3+
impl X : Drop {
4+
fn finalize() {
5+
error!("destructor runs");
6+
}
7+
}
28

39
fn main() {
410
let x = Some((X { x: () }, X { x: () }));

branches/dist-snap/src/test/compile-fail/bind-by-move-neither-can-live-while-the-other-survives-3.rs

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,10 @@
1-
struct X { x: (), drop { error!("destructor runs"); } }
1+
struct X { x: (), }
2+
3+
impl X : Drop {
4+
fn finalize() {
5+
error!("destructor runs");
6+
}
7+
}
28

39
enum double_option<T,U> { some2(T,U), none2 }
410

branches/dist-snap/src/test/compile-fail/bind-by-move-neither-can-live-while-the-other-survives-4.rs

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,10 @@
1-
struct X { x: (), drop { error!("destructor runs"); } }
1+
struct X { x: (), }
2+
3+
impl X : Drop {
4+
fn finalize() {
5+
error!("destructor runs");
6+
}
7+
}
28

39
fn main() {
410
let x = Some((X { x: () }, X { x: () }));

branches/dist-snap/src/test/compile-fail/bind-by-move-no-lvalues-1.rs

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,10 @@
1-
struct X { x: (), drop { error!("destructor runs"); } }
1+
struct X { x: (), }
2+
3+
impl X : Drop {
4+
fn finalize() {
5+
error!("destructor runs");
6+
}
7+
}
28

39
fn main() {
410
let x = Some(X { x: () });

branches/dist-snap/src/test/compile-fail/bind-by-move-no-lvalues-2.rs

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,11 @@
1-
struct X { x: (), drop { error!("destructor runs"); } }
1+
struct X { x: (), }
2+
3+
impl X : Drop {
4+
fn finalize() {
5+
error!("destructor runs");
6+
}
7+
}
8+
29
struct Y { y: Option<X> }
310

411
fn main() {

branches/dist-snap/src/test/compile-fail/bind-by-move-no-sub-bindings.rs

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,10 @@
1-
struct X { x: (), drop { error!("destructor runs"); } }
1+
struct X { x: (), }
2+
3+
impl X : Drop {
4+
fn finalize() {
5+
error!("destructor runs");
6+
}
7+
}
28

39
fn main() {
410
let x = Some(X { x: () });
Lines changed: 7 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,12 @@
11
// error-pattern:mismatched types: expected `()` but found `bool`
22

3-
struct r {
4-
drop { true }
3+
struct r {}
4+
5+
impl r : Drop {
6+
fn finalize() {
7+
true
8+
}
59
}
610

711
fn main() {
8-
}
12+
}

branches/dist-snap/src/test/compile-fail/borrowck-borrowed-uniq-rvalue-2.rs

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,11 @@
11
struct defer {
22
x: &[&str],
3-
drop { error!("%?", self.x); }
3+
}
4+
5+
impl defer : Drop {
6+
fn finalize() {
7+
error!("%?", self.x);
8+
}
49
}
510

611
fn defer(x: &r/[&r/str]) -> defer/&r {

branches/dist-snap/src/test/compile-fail/borrowck-unary-move-2.rs

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,11 @@
11
struct noncopyable {
2-
i: (), drop { error!("dropped"); }
2+
i: (),
3+
}
4+
5+
impl noncopyable : Drop {
6+
fn finalize() {
7+
error!("dropped");
8+
}
39
}
410

511
fn noncopyable() -> noncopyable {

branches/dist-snap/src/test/compile-fail/cap-clause-illegal-cap.rs

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,10 @@
11
// error-pattern: copying a noncopyable value
22

3-
struct foo { x: int, drop { } }
3+
struct foo { x: int, }
4+
5+
impl foo : Drop {
6+
fn finalize() {}
7+
}
48

59
fn foo(x: int) -> foo {
610
foo {

branches/dist-snap/src/test/compile-fail/copy-a-resource.rs

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,10 @@
22

33
struct foo {
44
i: int,
5-
drop {}
5+
}
6+
7+
impl foo : Drop {
8+
fn finalize() {}
69
}
710

811
fn foo(i:int) -> foo {

branches/dist-snap/src/test/compile-fail/disallowed-deconstructing-destructing-struct.rs

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,9 @@
11
struct X {
22
x: ~str,
3-
drop {
3+
}
4+
5+
impl X : Drop {
6+
fn finalize() {
47
error!("value: %s", self.x);
58
}
69
}

branches/dist-snap/src/test/compile-fail/functional-struct-update.rs

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,11 @@
11
struct Bar {
22
x: int,
3-
drop { io::println("Goodbye, cruel world"); }
3+
}
4+
5+
impl Bar : Drop {
6+
fn finalize() {
7+
io::println("Goodbye, cruel world");
8+
}
49
}
510

611
struct Foo {

branches/dist-snap/src/test/compile-fail/issue-2487-b.rs

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,9 @@
11
struct socket {
22
sock: int,
3+
}
34

4-
drop { }
5+
impl socket : Drop {
6+
fn finalize() {}
57
}
68

79
impl socket {

branches/dist-snap/src/test/compile-fail/issue-2548.rs

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,10 @@ struct foo {
44
x: @mut int,
55

66

7-
drop {
7+
}
8+
9+
impl foo : Drop {
10+
fn finalize() {
811
io::println("Goodbye, World!");
912
*self.x += 1;
1013
}

branches/dist-snap/src/test/compile-fail/issue-2587-2.rs

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,10 @@ fn bar<T>(+_t: T) { fail; }
1111

1212
struct S {
1313
x: int,
14-
drop {}
14+
}
15+
16+
impl S : Drop {
17+
fn finalize() {}
1518
}
1619

1720
fn S(x: int) -> S { S { x: x } }
Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,9 @@
11
struct C {
22
x: int,
3-
drop {
3+
}
4+
5+
impl C : Drop {
6+
fn finalize() {
47
error!("dropping: %?", self.x);
58
}
69
}
@@ -9,4 +12,4 @@ fn main() {
912
let c = C{ x: 2};
1013
let d = copy c; //~ ERROR copying a noncopyable value
1114
error!("%?", d.x);
12-
}
15+
}

branches/dist-snap/src/test/compile-fail/issue-2825-b.rs

Lines changed: 0 additions & 17 deletions
This file was deleted.

branches/dist-snap/src/test/compile-fail/issue-3214.rs

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,10 @@ fn foo<T>() {
22
struct foo {
33
mut x: T, //~ ERROR attempt to use a type argument out of scope
44
//~^ ERROR use of undeclared type name
5-
drop { }
5+
}
6+
7+
impl<T> foo<T> : Drop {
8+
fn finalize() {}
69
}
710
}
811
fn main() { }

branches/dist-snap/src/test/compile-fail/liveness-unused.rs

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -50,8 +50,12 @@ fn f4b() -> int {
5050
// leave this in here just to trigger compile-fail:
5151
struct r {
5252
x: (),
53-
drop {}
5453
}
54+
55+
impl r : Drop {
56+
fn finalize() {}
57+
}
58+
5559
fn main() {
5660
let x = r { x: () };
5761
fn@(move x) { copy x; }; //~ ERROR copying a noncopyable value

0 commit comments

Comments
 (0)