File tree Expand file tree Collapse file tree 6 files changed +44
-14
lines changed Expand file tree Collapse file tree 6 files changed +44
-14
lines changed Original file line number Diff line number Diff line change @@ -7,7 +7,11 @@ use std;
7
7
8
8
export context;
9
9
10
- resource arc_destruct<T : const >( _data: int) { }
10
+ class arc_destruct<T : const > {
11
+ let _data: int ;
12
+ new ( data: int) { self . _data = data; }
13
+ drop { }
14
+ }
11
15
12
16
fn arc<T : const >( _data: T ) -> arc_destruct<T > {
13
17
arc_destruct ( 0 )
Original file line number Diff line number Diff line change @@ -3,6 +3,8 @@ export rsrc;
3
3
fn foo ( _x : i32 ) {
4
4
}
5
5
6
- resource rsrc( x: i32) {
7
- foo ( x) ;
6
+ class rsrc {
7
+ let x: i32;
8
+ new ( x: i32) { self . x = x; }
9
+ drop { foo( self . x ) ; }
8
10
}
Original file line number Diff line number Diff line change 1
1
/*
2
- Minimized version of core::comm (with still-local modifications
3
- to turn a resource into a class) for testing.
2
+ Minimized version of core::comm for testing.
4
3
5
4
Could probably be more minimal.
6
5
*/
Original file line number Diff line number Diff line change @@ -41,7 +41,10 @@ enum st {
41
41
} )
42
42
}
43
43
44
- resource r( _l: @nillist) {
44
+ class r {
45
+ let _l: @nillist;
46
+ new ( l: @nillist) { self . _l = l; }
47
+ drop { }
45
48
}
46
49
47
50
fn recurse_or_fail( depth: int, st : option<st>) {
Original file line number Diff line number Diff line change 1
1
fn main ( ) {
2
- resource foo( _x: comm:: port<( ) >) { }
3
-
2
+ class foo {
3
+ let _x: comm:: port<( ) >;
4
+ new( x: comm:: port<( ) >) { self . _x = x; }
5
+ drop { }
6
+ }
7
+
4
8
let x = ~mut some ( foo ( comm:: port ( ) ) ) ;
5
9
6
10
task:: spawn { |move x| //! ERROR not a sendable value
Original file line number Diff line number Diff line change 1
- resource no0( x: & uint) { //! ERROR to use region types here, the containing type must be declared with a region bound
1
+ class no0 {
2
+ let x: & uint;
3
+ new ( x: & uint) { self . x = x; } //! ERROR to use region types here, the containing type must be declared with a region bound
4
+ drop { }
2
5
}
3
6
4
- resource no1( x: & self . uint ) { //! ERROR to use region types here, the containing type must be declared with a region bound
7
+ class no1 {
8
+ let x: & self . uint ;
9
+ new ( x: & self . uint ) { self . x = x; } //! ERROR to use region types here, the containing type must be declared with a region bound
10
+ drop { }
5
11
}
6
12
7
- resource no2( x: & foo. uint ) { //! ERROR named regions other than `self` are not allowed as part of a type declaration
13
+ class no2 {
14
+ let x: & foo. uint ;
15
+ new ( x: & foo. uint ) { self . x = x; } //! ERROR named regions other than `self` are not allowed as part of a type declaration
16
+ drop { }
8
17
}
9
18
10
- resource yes0/& ( x: & uint) {
19
+ class yes0/& {
20
+ let x: & uint ;
21
+ new ( x: & uint) { self . x = x; }
22
+ drop { }
11
23
}
12
24
13
- resource yes1/& ( x: & self . uint ) {
25
+ class yes1/& {
26
+ let x: & self . uint ;
27
+ new ( x: & self . uint ) { self . x = x; }
28
+ drop { }
14
29
}
15
30
16
- resource yes2/& ( x: & foo. uint ) { //! ERROR named regions other than `self` are not allowed as part of a type declaration
31
+ class yes2/& {
32
+ let x: & foo . uint ;
33
+ new ( x: & foo. uint ) { self . x = x; } //! ERROR named regions other than `self` are not allowed as part of a type declaration
34
+ drop { }
17
35
}
18
36
19
37
fn main ( ) { }
You can’t perform that action at this time.
0 commit comments