@@ -89,6 +89,7 @@ export mk_tag;
89
89
export mk_task;
90
90
export mk_type;
91
91
export mk_uint;
92
+ export mk_uniq;
92
93
export mk_var;
93
94
export mk_vec;
94
95
export mk_iter_body_fn;
@@ -147,6 +148,7 @@ export ty_tag;
147
148
export ty_task;
148
149
export ty_type;
149
150
export ty_uint;
151
+ export ty_uniq;
150
152
export ty_var;
151
153
export ty_var_id;
152
154
export ty_vec;
@@ -265,6 +267,7 @@ tag sty {
265
267
ty_istr;
266
268
ty_tag ( def_id, [ t] ) ;
267
269
ty_box ( mt) ;
270
+ ty_uniq ( t) ;
268
271
ty_vec ( mt) ;
269
272
ty_ivec ( mt) ;
270
273
ty_ptr ( mt) ;
@@ -471,6 +474,7 @@ fn mk_raw_ty(cx: &ctxt, st: &sty, in_cname: &option::t[str]) -> @raw_t {
471
474
for tt: t in tys { derive_flags_t ( cx, has_params, has_vars, tt) ; }
472
475
}
473
476
ty_box ( m) { derive_flags_mt ( cx, has_params, has_vars, m) ; }
477
+ ty_uniq ( tt) { derive_flags_t ( cx, has_params, has_vars, tt) ; }
474
478
ty_vec ( m) { derive_flags_mt ( cx, has_params, has_vars, m) ; }
475
479
ty_ivec ( m) { derive_flags_mt ( cx, has_params, has_vars, m) ; }
476
480
ty_ptr ( m) { derive_flags_mt ( cx, has_params, has_vars, m) ; }
@@ -558,6 +562,8 @@ fn mk_tag(cx: &ctxt, did: &ast::def_id, tys: &[t]) -> t {
558
562
559
563
fn mk_box ( cx : & ctxt , tm : & mt ) -> t { ret gen_ty ( cx, ty_box ( tm) ) ; }
560
564
565
+ fn mk_uniq ( cx : & ctxt , typ : & t ) -> t { ret gen_ty ( cx, ty_uniq ( typ) ) ; }
566
+
561
567
fn mk_ptr ( cx : & ctxt , tm : & mt ) -> t { ret gen_ty ( cx, ty_ptr ( tm) ) ; }
562
568
563
569
fn mk_imm_box ( cx : & ctxt , ty : & t ) -> t {
@@ -728,36 +734,20 @@ fn fold_ty(cx: &ctxt, fld: fold_mode, ty_0: t) -> t {
728
734
ty_native ( _) { /* no-op */ }
729
735
ty_task. { /* no-op */ }
730
736
ty_box ( tm) {
731
- ty =
732
- copy_cname ( cx,
733
- mk_box ( cx, { ty: fold_ty ( cx, fld, tm. ty ) , mut: tm. mut } ) ,
734
- ty) ;
737
+ ty = mk_box ( cx, { ty: fold_ty ( cx, fld, tm. ty ) , mut: tm. mut } ) ;
735
738
}
739
+ ty_uniq ( subty) { ty = mk_uniq ( cx, fold_ty ( cx, fld, subty) ) ; }
736
740
ty_ptr ( tm) {
737
- ty =
738
- copy_cname ( cx,
739
- mk_ptr ( cx, { ty: fold_ty ( cx, fld, tm. ty ) , mut: tm. mut } ) ,
740
- ty) ;
741
+ ty = mk_ptr ( cx, { ty: fold_ty ( cx, fld, tm. ty ) , mut: tm. mut } ) ;
741
742
}
742
743
ty_vec ( tm) {
743
- ty =
744
- copy_cname ( cx,
745
- mk_vec ( cx, { ty: fold_ty ( cx, fld, tm. ty ) , mut: tm. mut } ) ,
746
- ty) ;
744
+ ty = mk_vec ( cx, { ty: fold_ty ( cx, fld, tm. ty ) , mut: tm. mut } ) ;
747
745
}
748
746
ty_ivec ( tm) {
749
- ty =
750
- copy_cname ( cx,
751
- mk_ivec ( cx,
752
- { ty: fold_ty ( cx, fld, tm. ty ) , mut: tm. mut } ) ,
753
- ty) ;
754
- }
755
- ty_port ( subty) {
756
- ty = copy_cname ( cx, mk_port ( cx, fold_ty ( cx, fld, subty) ) , ty) ;
757
- }
758
- ty_chan ( subty) {
759
- ty = copy_cname ( cx, mk_chan ( cx, fold_ty ( cx, fld, subty) ) , ty) ;
747
+ ty = mk_ivec ( cx, { ty: fold_ty ( cx, fld, tm. ty ) , mut: tm. mut } ) ;
760
748
}
749
+ ty_port ( subty) { ty = mk_port ( cx, fold_ty ( cx, fld, subty) ) ; }
750
+ ty_chan ( subty) { ty = mk_chan ( cx, fold_ty ( cx, fld, subty) ) ; }
761
751
ty_tag ( tid, subtys) {
762
752
let new_subtys: [ t ] = ~[ ] ;
763
753
for subty: t in subtys { new_subtys += ~[ fold_ty ( cx, fld, subty) ] ; }
@@ -2494,6 +2484,20 @@ mod unify {
2494
2484
_ { ret ures_err ( terr_mismatch) ; }
2495
2485
}
2496
2486
}
2487
+ ty:: ty_uniq ( expected_sub) {
2488
+ alt struct( cx. tcx , actual) {
2489
+ ty:: ty_uniq ( actual_sub) {
2490
+ let result = unify_step ( cx, expected_sub, actual_sub) ;
2491
+ alt result {
2492
+ ures_ok( result_sub) {
2493
+ ret ures_ok ( mk_uniq ( cx. tcx , result_sub) ) ;
2494
+ }
2495
+ _ { ret result; }
2496
+ }
2497
+ }
2498
+ _ { ret ures_err( terr_mismatch) ; }
2499
+ }
2500
+ }
2497
2501
ty:: ty_vec ( expected_mt) {
2498
2502
alt struct( cx. tcx , actual) {
2499
2503
ty:: ty_vec ( actual_mt) {
0 commit comments