@@ -532,7 +532,7 @@ pub enum sty {
532
532
ty_rptr( Region , mt ) ,
533
533
ty_bare_fn( BareFnTy ) ,
534
534
ty_closure( ClosureTy ) ,
535
- ty_trait( def_id , substs , TraitStore ) ,
535
+ ty_trait( def_id , substs , TraitStore , ast :: mutability ) ,
536
536
ty_struct( def_id , substs ) ,
537
537
ty_tup( ~[ t ] ) ,
538
538
@@ -946,7 +946,7 @@ fn mk_t_with_id(cx: ctxt, +st: sty, o_def_id: Option<ast::def_id>) -> t {
946
946
& ty_infer( _) => flags |= needs_infer as uint ,
947
947
& ty_self( _) => flags |= has_self as uint ,
948
948
& ty_enum( _, ref substs) | & ty_struct( _, ref substs) |
949
- & ty_trait( _, ref substs, _) => {
949
+ & ty_trait( _, ref substs, _, _ ) => {
950
950
flags |= sflags ( substs) ;
951
951
}
952
952
& ty_box( ref m) | & ty_uniq( ref m) | & ty_evec( ref m, _) |
@@ -1115,10 +1115,11 @@ pub fn mk_ctor_fn(cx: ctxt, input_tys: &[ty::t], output: ty::t) -> t {
1115
1115
pub fn mk_trait ( cx : ctxt ,
1116
1116
did : ast:: def_id ,
1117
1117
+substs : substs ,
1118
- store : TraitStore )
1118
+ store : TraitStore ,
1119
+ mutability : ast:: mutability )
1119
1120
-> t {
1120
1121
// take a copy of substs so that we own the vectors inside
1121
- mk_t ( cx, ty_trait ( did, substs, store) )
1122
+ mk_t ( cx, ty_trait ( did, substs, store, mutability ) )
1122
1123
}
1123
1124
1124
1125
pub fn mk_struct ( cx : ctxt , struct_id : ast:: def_id , +substs : substs ) -> t {
@@ -1214,7 +1215,7 @@ pub fn maybe_walk_ty(ty: t, f: &fn(t) -> bool) {
1214
1215
maybe_walk_ty ( tm. ty , f) ;
1215
1216
}
1216
1217
ty_enum( _, ref substs) | ty_struct( _, ref substs) |
1217
- ty_trait( _, ref substs, _) => {
1218
+ ty_trait( _, ref substs, _, _ ) => {
1218
1219
for ( * substs) . tps. each |subty| { maybe_walk_ty ( * subty, f) ; }
1219
1220
}
1220
1221
ty_tup( ref ts) => { for ts. each |tt| { maybe_walk_ty ( * tt, f) ; } }
@@ -1277,8 +1278,8 @@ fn fold_sty(sty: &sty, fldop: &fn(t) -> t) -> sty {
1277
1278
ty_enum( tid, ref substs) => {
1278
1279
ty_enum ( tid, fold_substs ( substs, fldop) )
1279
1280
}
1280
- ty_trait( did, ref substs, st) => {
1281
- ty_trait ( did, fold_substs ( substs, fldop) , st)
1281
+ ty_trait( did, ref substs, st, mutbl ) => {
1282
+ ty_trait ( did, fold_substs ( substs, fldop) , st, mutbl )
1282
1283
}
1283
1284
ty_tup( ref ts) => {
1284
1285
let new_ts = ts. map ( |tt| fldop ( * tt) ) ;
@@ -1367,8 +1368,8 @@ pub fn fold_regions_and_ty(
1367
1368
ty_struct( def_id, ref substs) => {
1368
1369
ty:: mk_struct ( cx, def_id, fold_substs ( substs, fldr, fldt) )
1369
1370
}
1370
- ty_trait( def_id, ref substs, st) => {
1371
- ty:: mk_trait ( cx, def_id, fold_substs ( substs, fldr, fldt) , st)
1371
+ ty_trait( def_id, ref substs, st, mutbl ) => {
1372
+ ty:: mk_trait ( cx, def_id, fold_substs ( substs, fldr, fldt) , st, mutbl )
1372
1373
}
1373
1374
ty_bare_fn( ref f) => {
1374
1375
ty:: mk_bare_fn ( cx, BareFnTy { sig : fold_sig ( & f. sig , fldfnt) ,
@@ -1911,16 +1912,19 @@ pub fn type_contents(cx: ctxt, ty: t) -> TypeContents {
1911
1912
TC_MANAGED + nonowned(tc_mt(cx, mt, cache))
1912
1913
}
1913
1914
1914
- ty_trait(_, _, UniqTraitStore) => {
1915
+ ty_trait(_, _, UniqTraitStore, _ ) => {
1915
1916
TC_OWNED_CLOSURE
1916
1917
}
1917
1918
1918
- ty_trait(_, _, BoxTraitStore) => {
1919
- TC_MANAGED
1919
+ ty_trait(_, _, BoxTraitStore, mutbl) => {
1920
+ match mutbl {
1921
+ ast::m_mutbl => TC_MANAGED + TC_MUTABLE,
1922
+ _ => TC_MANAGED
1923
+ }
1920
1924
}
1921
1925
1922
- ty_trait(_, _, RegionTraitStore(r)) => {
1923
- borrowed_contents(r, m_imm )
1926
+ ty_trait(_, _, RegionTraitStore(r), mutbl ) => {
1927
+ borrowed_contents(r, mutbl )
1924
1928
}
1925
1929
1926
1930
ty_rptr(r, mt) => {
@@ -2241,7 +2245,7 @@ pub fn is_instantiable(cx: ctxt, r_ty: t) -> bool {
2241
2245
false // unsafe ptrs can always be NULL
2242
2246
}
2243
2247
2244
- ty_trait(_, _, _) => {
2248
+ ty_trait(_, _, _, _ ) => {
2245
2249
false
2246
2250
}
2247
2251
@@ -2385,7 +2389,7 @@ pub fn type_is_pod(cx: ctxt, ty: t) -> bool {
2385
2389
ty_box(_) | ty_uniq(_) | ty_closure(_) |
2386
2390
ty_estr(vstore_uniq) | ty_estr(vstore_box) |
2387
2391
ty_evec(_, vstore_uniq) | ty_evec(_, vstore_box) |
2388
- ty_trait(_, _, _) | ty_rptr(_,_) | ty_opaque_box => result = false,
2392
+ ty_trait(_, _, _, _ ) | ty_rptr(_,_) | ty_opaque_box => result = false,
2389
2393
// Structural types
2390
2394
ty_enum(did, ref substs) => {
2391
2395
let variants = enum_variants(cx, did);
@@ -2673,8 +2677,8 @@ impl to_bytes::IterBytes for sty {
2673
2677
ty_uniq(ref mt) =>
2674
2678
to_bytes::iter_bytes_2(&19u8, mt, lsb0, f),
2675
2679
2676
- ty_trait(ref did, ref substs, ref v) =>
2677
- to_bytes::iter_bytes_4 (&20u8, did, substs, v, lsb0, f),
2680
+ ty_trait(ref did, ref substs, ref v, ref mutbl ) =>
2681
+ to_bytes::iter_bytes_5 (&20u8, did, substs, v, mutbl , lsb0, f),
2678
2682
2679
2683
ty_opaque_closure_ptr(ref ck) =>
2680
2684
to_bytes::iter_bytes_2(&21u8, ck, lsb0, f),
@@ -3366,7 +3370,7 @@ pub fn ty_sort_str(cx: ctxt, t: t) -> ~str {
3366
3370
ty_rptr( _, _) => ~"& -ptr",
3367
3371
ty_bare_fn( _) => ~"extern fn ",
3368
3372
ty_closure ( _) => ~"fn ",
3369
- ty_trait( id, _, _) => fmt ! ( "trait %s" , item_path_str( cx, id) ) ,
3373
+ ty_trait( id, _, _, _ ) => fmt ! ( "trait %s" , item_path_str( cx, id) ) ,
3370
3374
ty_struct( id, _) => fmt ! ( "struct %s" , item_path_str( cx, id) ) ,
3371
3375
ty_tup( _) => ~"tuple",
3372
3376
ty_infer( TyVar ( _) ) => ~"inferred type",
@@ -3679,7 +3683,7 @@ pub fn impl_trait_refs(cx: ctxt, id: ast::def_id) -> ~[@TraitRef] {
3679
3683
3680
3684
pub fn ty_to_def_id ( ty : t ) -> Option < ast:: def_id > {
3681
3685
match get ( ty) . sty {
3682
- ty_trait( id, _, _) | ty_struct( id, _) | ty_enum( id, _) => Some ( id) ,
3686
+ ty_trait( id, _, _, _ ) | ty_struct( id, _) | ty_enum( id, _) => Some ( id) ,
3683
3687
_ => None
3684
3688
}
3685
3689
}
@@ -4413,7 +4417,7 @@ pub fn visitor_object_ty(tcx: ctxt) -> (@TraitRef, t) {
4413
4417
assert ! ( tcx. intrinsic_traits. contains_key( & ty_visitor_name) ) ;
4414
4418
let trait_ref = * tcx. intrinsic_traits . get ( & ty_visitor_name) ;
4415
4419
( trait_ref,
4416
- mk_trait ( tcx, trait_ref. def_id , copy trait_ref. substs , BoxTraitStore ) )
4420
+ mk_trait ( tcx, trait_ref. def_id , copy trait_ref. substs , BoxTraitStore , ast :: m_imm ) )
4417
4421
}
4418
4422
4419
4423
// Local Variables:
0 commit comments