Change DST syntax: type -> Sized?

closes #13367

[breaking-change] Use `Sized?` to indicate a dynamically sized type parameter or trait (used to be `type`). E.g.,

```
trait Tr for Sized? {}

fn foo<Sized? X: Share>(x: X) {}
```
This commit is contained in:
Nick Cameron
2014-07-08 14:26:02 +12:00
parent 6959931498
commit a0cfda53c4
29 changed files with 215 additions and 178 deletions

View File

@@ -184,8 +184,8 @@ pub enum TyParamBound {
pub struct TyParam {
pub ident: Ident,
pub id: NodeId,
pub sized: Sized,
pub bounds: OwnedSlice<TyParamBound>,
pub unbound: Option<TyParamBound>,
pub default: Option<P<Ty>>,
pub span: Span
}
@@ -1041,12 +1041,6 @@ impl Visibility {
}
}
#[deriving(Clone, PartialEq, Eq, Encodable, Decodable, Hash)]
pub enum Sized {
DynSize,
StaticSize,
}
#[deriving(Clone, PartialEq, Eq, Encodable, Decodable, Hash)]
pub struct StructField_ {
pub kind: StructFieldKind,
@@ -1115,7 +1109,11 @@ pub enum Item_ {
ItemEnum(EnumDef, Generics),
ItemStruct(Gc<StructDef>, Generics),
/// Represents a Trait Declaration
ItemTrait(Generics, Sized, Vec<TraitRef> , Vec<TraitMethod> ),
ItemTrait(Generics,
Option<TyParamBound>, // (optional) default bound not required for Self.
// Currently, only Sized makes sense here.
Vec<TraitRef> ,
Vec<TraitMethod>),
ItemImpl(Generics,
Option<TraitRef>, // (optional) trait this impl implements
P<Ty>, // self