1
Fork 0

Simplify the AST representation of ty param bounds

Change ast::ty_param_bound so that all ty param bounds are represented
as traits, with no special cases for Copy/Send/Owned/Const.
typeck::collect generates the special cases.

A consequence of this is that code using the #[no_core] attribute
can't use the Copy kind/trait. Probably not a big deal?

As a side effect, any user-defined traits that happen to be called
Copy, etc. in the same module override the built-in Copy trait.

r=nmatsakis

Closes #2284
This commit is contained in:
Tim Chevalier 2012-10-16 22:14:59 -07:00
parent 42c05fe642
commit 46d4bbbae4
10 changed files with 59 additions and 67 deletions

View file

@ -131,10 +131,7 @@ fn fold_fn_decl(decl: ast::fn_decl, fld: ast_fold) -> ast::fn_decl {
}
fn fold_ty_param_bound(tpb: ty_param_bound, fld: ast_fold) -> ty_param_bound {
match tpb {
bound_copy | bound_send | bound_const | bound_owned => tpb,
bound_trait(ty) => bound_trait(fld.fold_ty(ty))
}
ty_param_bound(fld.fold_ty(*tpb))
}
fn fold_ty_param(tp: ty_param, fld: ast_fold) -> ty_param {