about summary refs log tree commit diff
diff options
context:
space:
mode:
authorEduard Burtescu <edy.burt@gmail.com>2014-04-10 18:01:07 +0300
committerEduard Burtescu <edy.burt@gmail.com>2014-04-10 20:18:46 +0300
commita62eba7abf5fe16dc79ae506f9582f0b3b9380c5 (patch)
treef2219c168c3ae9dd85a020f3a889603a2666fd29
parent2803b383f099e71d6eb885d0ea7c01d771dc7e46 (diff)
downloadrust-a62eba7abf5fe16dc79ae506f9582f0b3b9380c5.tar.gz
rust-a62eba7abf5fe16dc79ae506f9582f0b3b9380c5.zip
rustc: move mutability from ty_vec and ty_trait to VstoreSlice and RegionTraitStore.
-rw-r--r--src/librustc/middle/ty.rs21
1 files changed, 14 insertions, 7 deletions
diff --git a/src/librustc/middle/ty.rs b/src/librustc/middle/ty.rs
index 9e0a818ed2d..05f16896a49 100644
--- a/src/librustc/middle/ty.rs
+++ b/src/librustc/middle/ty.rs
@@ -130,16 +130,24 @@ pub struct mt {
 }
 
 #[deriving(Clone, Eq, TotalEq, Encodable, Decodable, Hash, Show)]
-pub enum Vstore {
+/// Describes the "storage mode" of a `[]`, whether it's fixed length or a slice.
+///
+/// Set M to () to disable mutable slices.
+pub enum Vstore<M = ast::Mutability> {
+    /// [T, ..N]
     VstoreFixed(uint),
+    /// ~[T]
     VstoreUniq,
-    VstoreSlice(Region)
+    /// &[T] and &mut [T]
+    VstoreSlice(Region, M)
 }
 
 #[deriving(Clone, Eq, TotalEq, Hash, Encodable, Decodable, Show)]
 pub enum TraitStore {
-    UniqTraitStore,             // ~Trait
-    RegionTraitStore(Region),   // &Trait
+    /// ~Trait
+    UniqTraitStore,
+    /// &Trait and &mut Trait
+    RegionTraitStore(Region, ast::Mutability),
 }
 
 pub struct field_ty {
@@ -729,11 +737,11 @@ pub enum sty {
     ty_int(ast::IntTy),
     ty_uint(ast::UintTy),
     ty_float(ast::FloatTy),
-    ty_str(Vstore),
     ty_enum(DefId, substs),
     ty_box(t),
     ty_uniq(t),
-    ty_vec(mt, Vstore),
+    ty_str(Vstore<()>),
+    ty_vec(t, Vstore),
     ty_ptr(mt),
     ty_rptr(Region, mt),
     ty_bare_fn(BareFnTy),
@@ -757,7 +765,6 @@ pub struct TyTrait {
     pub def_id: DefId,
     pub substs: substs,
     pub store: TraitStore,
-    pub mutability: ast::Mutability,
     pub bounds: BuiltinBounds
 }