Skip to content

Commit

Permalink
rustc: move mutability from ty_vec and ty_trait to VstoreSlice and Re…
Browse files Browse the repository at this point in the history
…gionTraitStore.
  • Loading branch information
eddyb committed Apr 10, 2014
1 parent 2803b38 commit a62eba7
Showing 1 changed file with 14 additions and 7 deletions.
21 changes: 14 additions & 7 deletions src/librustc/middle/ty.rs
Expand Up @@ -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 {
Expand Down Expand Up @@ -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),
Expand All @@ -757,7 +765,6 @@ pub struct TyTrait {
pub def_id: DefId,
pub substs: substs,
pub store: TraitStore,
pub mutability: ast::Mutability,
pub bounds: BuiltinBounds
}

Expand Down

0 comments on commit a62eba7

Please sign in to comment.