Skip to content

Commit a62eba7

Browse files
committed
rustc: move mutability from ty_vec and ty_trait to VstoreSlice and RegionTraitStore.
1 parent 2803b38 commit a62eba7

File tree

1 file changed

+14
-7
lines changed

1 file changed

+14
-7
lines changed

src/librustc/middle/ty.rs

+14-7
Original file line numberDiff line numberDiff line change
@@ -130,16 +130,24 @@ pub struct mt {
130130
}
131131

132132
#[deriving(Clone, Eq, TotalEq, Encodable, Decodable, Hash, Show)]
133-
pub enum Vstore {
133+
/// Describes the "storage mode" of a `[]`, whether it's fixed length or a slice.
134+
///
135+
/// Set M to () to disable mutable slices.
136+
pub enum Vstore<M = ast::Mutability> {
137+
/// [T, ..N]
134138
VstoreFixed(uint),
139+
/// ~[T]
135140
VstoreUniq,
136-
VstoreSlice(Region)
141+
/// &[T] and &mut [T]
142+
VstoreSlice(Region, M)
137143
}
138144

139145
#[deriving(Clone, Eq, TotalEq, Hash, Encodable, Decodable, Show)]
140146
pub enum TraitStore {
141-
UniqTraitStore, // ~Trait
142-
RegionTraitStore(Region), // &Trait
147+
/// ~Trait
148+
UniqTraitStore,
149+
/// &Trait and &mut Trait
150+
RegionTraitStore(Region, ast::Mutability),
143151
}
144152

145153
pub struct field_ty {
@@ -729,11 +737,11 @@ pub enum sty {
729737
ty_int(ast::IntTy),
730738
ty_uint(ast::UintTy),
731739
ty_float(ast::FloatTy),
732-
ty_str(Vstore),
733740
ty_enum(DefId, substs),
734741
ty_box(t),
735742
ty_uniq(t),
736-
ty_vec(mt, Vstore),
743+
ty_str(Vstore<()>),
744+
ty_vec(t, Vstore),
737745
ty_ptr(mt),
738746
ty_rptr(Region, mt),
739747
ty_bare_fn(BareFnTy),
@@ -757,7 +765,6 @@ pub struct TyTrait {
757765
pub def_id: DefId,
758766
pub substs: substs,
759767
pub store: TraitStore,
760-
pub mutability: ast::Mutability,
761768
pub bounds: BuiltinBounds
762769
}
763770

0 commit comments

Comments
 (0)