Support unsized types with the type keyword

This commit is contained in:
Nick Cameron
2014-04-03 13:38:45 +13:00
parent c3b2f2b0c6
commit f78add10cd
39 changed files with 484 additions and 73 deletions

View File

@@ -180,6 +180,7 @@ pub enum TyParamBound {
pub struct TyParam {
pub ident: Ident,
pub id: NodeId,
pub sized: Sized,
pub bounds: OwnedSlice<TyParamBound>,
pub default: Option<P<Ty>>,
pub span: Span
@@ -1051,6 +1052,12 @@ impl Visibility {
}
}
#[deriving(Clone, Eq, TotalEq, Encodable, Decodable, Hash)]
pub enum Sized {
DynSize,
StaticSize,
}
#[deriving(Clone, Eq, TotalEq, Encodable, Decodable, Hash)]
pub struct StructField_ {
pub kind: StructFieldKind,
@@ -1109,7 +1116,7 @@ pub enum Item_ {
ItemTy(P<Ty>, Generics),
ItemEnum(EnumDef, Generics),
ItemStruct(@StructDef, Generics),
ItemTrait(Generics, Vec<TraitRef> , Vec<TraitMethod> ),
ItemTrait(Generics, Sized, Vec<TraitRef> , Vec<TraitMethod> ),
ItemImpl(Generics,
Option<TraitRef>, // (optional) trait this impl implements
P<Ty>, // self