File tree 3 files changed +28
-7
lines changed
3 files changed +28
-7
lines changed Original file line number Diff line number Diff line change @@ -356,7 +356,7 @@ cmp::walk_struct2(const uint8_t *end_sp) {
356
356
357
357
void
358
358
cmp::walk_res2 (const rust_fn *dtor, const uint8_t *end_sp) {
359
- abort (); // TODO
359
+ return cmp_two_pointers ();
360
360
}
361
361
362
362
void
Original file line number Diff line number Diff line change @@ -334,7 +334,7 @@ fn shape_of(ccx: @crate_ctxt, t: ty::t) -> [u8] {
334
334
let mut s = if option:: is_some ( m_dtor_did) {
335
335
[ shape_res]
336
336
}
337
- else { [ shape_struct] } ;
337
+ else { [ shape_struct] } , sub = [ ] ;
338
338
option:: iter ( m_dtor_did) { |dtor_did|
339
339
let ri = @{ did: dtor_did, parent_id: some ( did) , tps: tps} ;
340
340
let id = interner:: intern ( ccx. shape_cx . resources , ri) ;
@@ -345,8 +345,9 @@ fn shape_of(ccx: @crate_ctxt, t: ty::t) -> [u8] {
345
345
add_u16 ( s, 0_u16 ) ;
346
346
} ;
347
347
for ty:: class_items_as_mutable_fields( ccx. tcx, did, substs) . each { |f|
348
- add_substr ( s , shape_of( ccx, f. mt. ty) ) ;
348
+ sub += shape_of( ccx, f. mt. ty) ;
349
349
}
350
+ add_substr( s, sub) ;
350
351
s
351
352
}
352
353
ty:: ty_rptr( _, mt) {
Original file line number Diff line number Diff line change @@ -60,14 +60,11 @@ fn test_box() {
60
60
}
61
61
62
62
fn test_port ( ) {
63
- // FIXME: Re-enable this once we can compare resources. (#2601)
64
- /*
65
63
let p1 = comm:: port :: < int > ( ) ;
66
64
let p2 = comm:: port :: < int > ( ) ;
67
65
68
66
assert ( p1 == p1) ;
69
67
assert ( p1 != p2) ;
70
- */
71
68
}
72
69
73
70
fn test_chan ( ) {
@@ -98,7 +95,7 @@ fn test_ptr() unsafe {
98
95
fn test_fn ( ) {
99
96
fn f ( ) { }
100
97
fn g ( ) { }
101
- fn h ( i : int ) { }
98
+ fn h ( _i : int ) { }
102
99
let f1 = f;
103
100
let f2 = f;
104
101
let g1 = g;
@@ -128,6 +125,28 @@ fn test_native_fn() {
128
125
assert test:: unsupervise == test:: unsupervise;
129
126
}
130
127
128
+ class p {
129
+ let mut x: int;
130
+ let mut y: int ;
131
+ new ( x: int, y: int) { self . x = x; self . y = y; }
132
+ }
133
+
134
+ fn test_class ( ) {
135
+ let q = p ( 1 , 2 ) ;
136
+ let r = p ( 1 , 2 ) ;
137
+
138
+ unsafe {
139
+ #error ( "q = %x, r = %x" ,
140
+ ( unsafe :: reinterpret_cast :: < * p , uint > ( ptr:: addr_of ( q) ) ) ,
141
+ ( unsafe :: reinterpret_cast :: < * p , uint > ( ptr:: addr_of ( r) ) ) ) ;
142
+ }
143
+ assert ( q == r) ;
144
+ r. y = 17 ;
145
+ assert ( r. y != q. y ) ;
146
+ assert ( r. y == 17 ) ;
147
+ assert ( q != r) ;
148
+ }
149
+
131
150
fn main ( ) {
132
151
test_nil ( ) ;
133
152
test_bool ( ) ;
@@ -138,4 +157,5 @@ fn main() {
138
157
test_ptr ( ) ;
139
158
test_fn ( ) ;
140
159
test_native_fn ( ) ;
160
+ test_class ( ) ;
141
161
}
You can’t perform that action at this time.
0 commit comments