File tree Expand file tree Collapse file tree 7 files changed +18
-12
lines changed Expand file tree Collapse file tree 7 files changed +18
-12
lines changed Original file line number Diff line number Diff line change 3
3
// Test that a class with a non-copyable field can't be
4
4
// copied
5
5
class bar {
6
- new( ) { }
6
+ let x: int;
7
+ new ( x: int) { self . x = x; }
7
8
drop { }
8
9
}
9
10
10
11
class foo {
11
12
let i: int;
12
13
let j: bar ;
13
- new ( i: int) { self . i = i; self . j = bar ( ) ; }
14
+ new ( i: int) { self . i = i; self . j = bar ( 5 ) ; }
14
15
}
15
16
16
17
fn main ( ) { let x <- foo( 10 ) ; let y = x; log ( error, x) ; }
Original file line number Diff line number Diff line change 4
4
5
5
enum an_enum /& { }
6
6
iface an_iface/& { }
7
- class a_class/& { new ( ) { } }
7
+ class a_class/& { let x : int ; new ( x : int ) { self . x = x ; } }
8
8
9
9
fn a_fn1 ( e : an_enum/& a ) -> an_enum/& b {
10
10
ret e; //! ERROR mismatched types: expected `an_enum/&b` but found `an_enum/&a`
Original file line number Diff line number Diff line change 1
1
// error-pattern: copying a noncopyable value
2
2
3
3
class r {
4
- new( _i : int) { }
4
+ let i: int;
5
+ new ( i: int) { self . i = i; }
5
6
drop { }
6
7
}
7
8
Original file line number Diff line number Diff line change @@ -21,7 +21,8 @@ fn getbig_call_c_and_fail(i: int) {
21
21
}
22
22
23
23
class and_then_get_big_again {
24
- new( ) { }
24
+ let x: int;
25
+ new ( x: int) { self . x = x; }
25
26
drop {
26
27
fn getbig( i: int) {
27
28
if i != 0 {
@@ -34,7 +35,7 @@ class and_then_get_big_again {
34
35
35
36
fn main ( ) {
36
37
task:: spawn { ||
37
- let r = and_then_get_big_again ( ) ;
38
+ let r = and_then_get_big_again ( 4 ) ;
38
39
getbig_call_c_and_fail ( 10000 ) ;
39
40
} ;
40
41
}
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 ( ) ;
8
+ let _r = and_then_get_big_again ( 5 ) ;
9
9
if i != 0 {
10
10
getbig_and_fail ( i - 1 ) ;
11
11
} else {
@@ -14,7 +14,8 @@ fn getbig_and_fail(&&i: int) {
14
14
}
15
15
16
16
class and_then_get_big_again {
17
- new( ) { }
17
+ let x: int;
18
+ new ( x: int) { self . x = x; }
18
19
drop {
19
20
fn getbig( i: int) {
20
21
if i != 0 {
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 ( ) ;
8
+ let r = and_then_get_big_again ( 5 ) ;
9
9
if i != 0 {
10
10
getbig_and_fail ( i - 1 ) ;
11
11
} else {
@@ -14,7 +14,8 @@ fn getbig_and_fail(&&i: int) {
14
14
}
15
15
16
16
class and_then_get_big_again {
17
- new( ) { }
17
+ let x: int;
18
+ new ( x: int) { self . x = x; }
18
19
drop { }
19
20
}
20
21
Original file line number Diff line number Diff line change 1
1
// error-pattern:whatever
2
2
3
3
class r {
4
+ let x: int;
4
5
// Setting the exit status after the runtime has already
5
6
// failed has no effect and the process exits with the
6
7
// runtime's exit code
7
8
drop {
8
9
os : : set_exit_status ( 50 ) ;
9
10
}
10
- new( ) { }
11
+ new( x : int ) { self . x = x ; }
11
12
}
12
13
13
14
fn main ( ) {
14
15
log ( error, "whatever" ) ;
15
16
task:: spawn { ||
16
- let i = r ( ) ;
17
+ let i = r ( 5 ) ;
17
18
} ;
18
19
fail;
19
20
}
You can’t perform that action at this time.
0 commit comments