File tree Expand file tree Collapse file tree 10 files changed +48
-26
lines changed
branches/try/src/test/run-fail Expand file tree Collapse file tree 10 files changed +48
-26
lines changed Original file line number Diff line number Diff line change 2
2
refs/heads/master: 61b1875c16de39c166b0f4d54bba19f9c6777d1a
3
3
refs/heads/snap-stage1: e33de59e47c5076a89eadeb38f4934f58a3618a6
4
4
refs/heads/snap-stage3: 4a81779abd786ff22d71434c6d9a5917ea4cdfff
5
- refs/heads/try: ebde93861fc004aec9d1fdac528cca9aad9a7612
5
+ refs/heads/try: 7daf986aeca81a72be5869a5a41d4fde753eca0f
6
6
refs/tags/release-0.1: 1f5c5126e96c79d22cb7862f75304136e204f105
Original file line number Diff line number Diff line change @@ -20,18 +20,21 @@ fn getbig_call_c_and_fail(i: int) {
20
20
}
21
21
}
22
22
23
- resource and_then_get_big_again ( _i : ( ) ) {
23
+ class and_then_get_big_again {
24
+ new( ) { }
25
+ drop {
24
26
fn getbig( i: int) {
25
27
if i != 0 {
26
28
getbig ( i - 1 ) ;
27
29
}
28
30
}
29
31
getbig ( 10000 ) ;
32
+ }
30
33
}
31
34
32
35
fn main ( ) {
33
36
task:: spawn { ||
34
- let r = and_then_get_big_again ( ( ) ) ;
37
+ let r = and_then_get_big_again ( ) ;
35
38
getbig_call_c_and_fail ( 10000 ) ;
36
39
} ;
37
40
}
Original file line number Diff line number Diff line change 5
5
use std;
6
6
7
7
fn getbig_and_fail ( & & i: int ) {
8
- let r = and_then_get_big_again ( @ 0 ) ;
8
+ let _r = and_then_get_big_again ( ) ;
9
9
if i != 0 {
10
10
getbig_and_fail ( i - 1 ) ;
11
11
} else {
12
12
fail;
13
13
}
14
14
}
15
15
16
- resource and_then_get_big_again ( _i: @int) {
16
+ class and_then_get_big_again {
17
+ new( ) { }
18
+ drop {
17
19
fn getbig( i: int) {
18
20
if i != 0 {
19
21
getbig ( i - 1 ) ;
20
22
}
21
23
}
22
24
getbig ( 100 ) ;
25
+ }
23
26
}
24
27
25
28
fn main ( ) {
Original file line number Diff line number Diff line change 5
5
use std;
6
6
7
7
fn getbig_and_fail ( & & i: int ) {
8
- let r = and_then_get_big_again ( @ 0 ) ;
8
+ let r = and_then_get_big_again ( ) ;
9
9
if i != 0 {
10
10
getbig_and_fail ( i - 1 ) ;
11
11
} else {
12
12
fail;
13
13
}
14
14
}
15
15
16
- resource and_then_get_big_again ( _i: @int) {
16
+ class and_then_get_big_again {
17
+ new( ) { }
18
+ drop { }
17
19
}
18
20
19
21
fn main ( ) {
Original file line number Diff line number Diff line change 1
1
// error-pattern:whatever
2
2
3
- fn main ( ) {
4
- log ( error, "whatever" ) ;
5
- task:: spawn { ||
6
- resource r( _i : ( ) ) {
3
+ class r {
7
4
// Setting the exit status after the runtime has already
8
5
// failed has no effect and the process exits with the
9
6
// runtime's exit code
10
- os:: set_exit_status ( 50 ) ;
11
- }
12
- let i = r ( ( ) ) ;
7
+ drop {
8
+ os : : set_exit_status ( 50 ) ;
9
+ }
10
+ new( ) { }
11
+ }
12
+
13
+ fn main ( ) {
14
+ log ( error, "whatever" ) ;
15
+ task:: spawn { ||
16
+ let i = r ( ) ;
13
17
} ;
14
18
fail;
15
19
}
Original file line number Diff line number Diff line change @@ -9,11 +9,15 @@ fn recurse() {
9
9
recurse ( ) ;
10
10
}
11
11
12
- resource r( recursed: * mut bool) unsafe {
12
+ class r {
13
+ let recursed: * mut bool;
14
+ new ( recursed: * mut bool) unsafe { self . recursed = recursed; }
15
+ drop unsafe {
13
16
if !* recursed {
14
17
* recursed = true ;
15
18
recurse ( ) ;
16
19
}
20
+ }
17
21
}
18
22
19
23
fn main ( ) {
Original file line number Diff line number Diff line change @@ -4,8 +4,12 @@ fn failfn() {
4
4
fail;
5
5
}
6
6
7
- resource r( v: * int) unsafe {
8
- let v2: ~int = unsafe :: reinterpret_cast ( v) ;
7
+ class r {
8
+ let v: * int;
9
+ new ( v: * int) { self . v = v; }
10
+ drop unsafe {
11
+ let _v2: ~int = unsafe :: reinterpret_cast ( self . v ) ;
12
+ }
9
13
}
10
14
11
15
fn main ( ) unsafe {
Original file line number Diff line number Diff line change 1
1
// error-pattern:fail
2
2
// xfail-test
3
3
4
- resource r ( i : int ) {
5
- // What happens when destructors throw?
6
- fail;
4
+ class r {
5
+ new ( i : int ) { }
6
+ drop { fail; }
7
7
}
8
8
9
9
fn main ( ) {
Original file line number Diff line number Diff line change 1
1
// error-pattern:fail
2
2
// xfail-test
3
3
4
- resource r ( i : int ) {
5
- // Double-fail!!
6
- fail;
4
+ class r {
5
+ new ( i : int ) { }
6
+ drop { fail; }
7
7
}
8
8
9
9
fn main ( ) {
Original file line number Diff line number Diff line change 1
1
// error-pattern:quux
2
2
// xfail-test
3
3
4
- resource faily_box ( _i: @int) {
5
- // What happens to the box pointer owned by this resource?
6
- fail "quux" ;
4
+ class faily_box {
5
+ let i: @int;
6
+ new ( i: @int) { self . i = i; }
7
+ // What happens to the box pointer owned by this class?
8
+ drop { fail "quux" ; }
7
9
}
8
10
9
11
fn main ( ) {
You can’t perform that action at this time.
0 commit comments