rustc: Implement parsing and typechecking for "once fn"

This commit is contained in:
Patrick Walton
2012-11-02 13:33:51 -07:00
parent 9aadfc3f4b
commit be93b29d30
22 changed files with 266 additions and 61 deletions

View File

@@ -1059,6 +1059,25 @@ enum region_ {
re_named(ident)
}
#[auto_serialize]
#[auto_deserialize]
enum Onceness {
Once,
Many
}
impl Onceness : cmp::Eq {
pure fn eq(other: &Onceness) -> bool {
match (self, *other) {
(Once, Once) | (Many, Many) => true,
_ => false
}
}
pure fn ne(other: &Onceness) -> bool {
!self.eq(other)
}
}
#[auto_serialize]
#[auto_deserialize]
enum ty_ {
@@ -1070,7 +1089,7 @@ enum ty_ {
ty_ptr(mt),
ty_rptr(@region, mt),
ty_rec(~[ty_field]),
ty_fn(proto, purity, @~[ty_param_bound], fn_decl),
ty_fn(proto, purity, Onceness, @~[ty_param_bound], fn_decl),
ty_tup(~[@Ty]),
ty_path(@path, node_id),
ty_fixed_length(@Ty, Option<uint>),