Front-end support for default impls in traits.
This commit is contained in:
parent
d5563d732d
commit
fc9c4c3245
14 changed files with 252 additions and 68 deletions
|
@ -452,6 +452,15 @@ type ty_field = spanned<ty_field_>;
|
|||
type ty_method = {ident: ident, attrs: ~[attribute],
|
||||
decl: fn_decl, tps: ~[ty_param], span: span};
|
||||
|
||||
#[auto_serialize]
|
||||
// A trait method is either required (meaning it doesn't have an
|
||||
// implementation, just a signature) or provided (meaning it has a default
|
||||
// implementation).
|
||||
enum trait_method {
|
||||
required(ty_method),
|
||||
provided(@method),
|
||||
}
|
||||
|
||||
#[auto_serialize]
|
||||
enum int_ty { ty_i, ty_char, ty_i8, ty_i16, ty_i32, ty_i64, }
|
||||
|
||||
|
@ -695,7 +704,7 @@ enum item_ {
|
|||
/* dtor is optional */
|
||||
option<class_dtor>
|
||||
),
|
||||
item_trait(~[ty_param], ~[ty_method]),
|
||||
item_trait(~[ty_param], ~[trait_method]),
|
||||
item_impl(~[ty_param], option<@trait_ref> /* trait */,
|
||||
@ty /* self */, ~[@method]),
|
||||
item_mac(mac),
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue