diff options
| author | Marijn Haverbeke <marijnh@gmail.com> | 2012-01-05 15:35:37 +0100 |
|---|---|---|
| committer | Marijn Haverbeke <marijnh@gmail.com> | 2012-01-05 15:50:02 +0100 |
| commit | 60ae1590af034755b5cb1e1e71f2240a710299a2 (patch) | |
| tree | 605d11f071a776c0ca33dcfea0a774379b0880bb /src/comp/syntax | |
| parent | 1f71a0f48d18d80ff3be6970d582c5a67f976329 (diff) | |
| download | rust-60ae1590af034755b5cb1e1e71f2240a710299a2.tar.gz rust-60ae1590af034755b5cb1e1e71f2240a710299a2.zip | |
Switch to new param kind bound syntax
And remove support for the old syntax
Diffstat (limited to 'src/comp/syntax')
| -rw-r--r-- | src/comp/syntax/ast_util.rs | 4 | ||||
| -rw-r--r-- | src/comp/syntax/ext/simplext.rs | 2 | ||||
| -rw-r--r-- | src/comp/syntax/parse/parser.rs | 18 | ||||
| -rw-r--r-- | src/comp/syntax/util/interner.rs | 6 |
4 files changed, 14 insertions, 16 deletions
diff --git a/src/comp/syntax/ast_util.rs b/src/comp/syntax/ast_util.rs index 7a77861ae0b..121abc1ce5c 100644 --- a/src/comp/syntax/ast_util.rs +++ b/src/comp/syntax/ast_util.rs @@ -1,7 +1,7 @@ import codemap::span; import ast::*; -fn respan<copy T>(sp: span, t: T) -> spanned<T> { +fn respan<T: copy>(sp: span, t: T) -> spanned<T> { ret {node: t, span: sp}; } @@ -201,7 +201,7 @@ fn eq_def_id(&&a: def_id, &&b: def_id) -> bool { a == b } -fn new_def_id_hash<copy T>() -> std::map::hashmap<def_id, T> { +fn new_def_id_hash<T: copy>() -> std::map::hashmap<def_id, T> { std::map::mk_hashmap(hash_def_id, eq_def_id) } diff --git a/src/comp/syntax/ext/simplext.rs b/src/comp/syntax/ext/simplext.rs index 371370c5eda..8f6f1a5828a 100644 --- a/src/comp/syntax/ext/simplext.rs +++ b/src/comp/syntax/ext/simplext.rs @@ -103,7 +103,7 @@ fn elts_to_ell(cx: ext_ctxt, elts: [@expr]) -> } } -fn option_flatten_map<copy T, copy U>(f: fn@(T) -> option::t<U>, v: [T]) -> +fn option_flatten_map<T: copy, U: copy>(f: fn@(T) -> option::t<U>, v: [T]) -> option::t<[U]> { let res = []; for elem: T in v { diff --git a/src/comp/syntax/parse/parser.rs b/src/comp/syntax/parse/parser.rs index 990132e01bf..d9edeefd44d 100644 --- a/src/comp/syntax/parse/parser.rs +++ b/src/comp/syntax/parse/parser.rs @@ -210,7 +210,7 @@ fn expect_gt(p: parser) { } } -fn spanned<copy T>(lo: uint, hi: uint, node: T) -> spanned<T> { +fn spanned<T: copy>(lo: uint, hi: uint, node: T) -> spanned<T> { ret {node: node, span: ast_util::mk_sp(lo, hi)}; } @@ -378,7 +378,7 @@ fn parse_constr_in_type(p: parser) -> @ast::ty_constr { } -fn parse_constrs<copy T>(pser: block(parser) -> @ast::constr_general<T>, +fn parse_constrs<T: copy>(pser: block(parser) -> @ast::constr_general<T>, p: parser) -> [@ast::constr_general<T>] { let constrs: [@ast::constr_general<T>] = []; @@ -554,7 +554,7 @@ fn parse_fn_block_arg(p: parser) -> ast::arg { ret {mode: m, ty: t, ident: i, id: p.get_id()}; } -fn parse_seq_to_before_gt<copy T>(sep: option::t<token::token>, +fn parse_seq_to_before_gt<T: copy>(sep: option::t<token::token>, f: block(parser) -> T, p: parser) -> [T] { let first = true; @@ -571,7 +571,7 @@ fn parse_seq_to_before_gt<copy T>(sep: option::t<token::token>, ret v; } -fn parse_seq_to_gt<copy T>(sep: option::t<token::token>, +fn parse_seq_to_gt<T: copy>(sep: option::t<token::token>, f: block(parser) -> T, p: parser) -> [T] { let v = parse_seq_to_before_gt(sep, f, p); expect_gt(p); @@ -579,7 +579,7 @@ fn parse_seq_to_gt<copy T>(sep: option::t<token::token>, ret v; } -fn parse_seq_lt_gt<copy T>(sep: option::t<token::token>, +fn parse_seq_lt_gt<T: copy>(sep: option::t<token::token>, f: block(parser) -> T, p: parser) -> spanned<[T]> { let lo = p.get_lo_pos(); @@ -590,7 +590,7 @@ fn parse_seq_lt_gt<copy T>(sep: option::t<token::token>, ret spanned(lo, hi, result); } -fn parse_seq_to_end<copy T>(ket: token::token, sep: seq_sep, +fn parse_seq_to_end<T: copy>(ket: token::token, sep: seq_sep, f: block(parser) -> T, p: parser) -> [T] { let val = parse_seq_to_before_end(ket, sep, f, p); p.bump(); @@ -612,7 +612,7 @@ fn seq_sep_none() -> seq_sep { ret {sep: option::none, trailing_opt: false}; } -fn parse_seq_to_before_end<copy T>(ket: token::token, +fn parse_seq_to_before_end<T: copy>(ket: token::token, sep: seq_sep, f: block(parser) -> T, p: parser) -> [T] { let first: bool = true; @@ -629,7 +629,7 @@ fn parse_seq_to_before_end<copy T>(ket: token::token, } -fn parse_seq<copy T>(bra: token::token, ket: token::token, +fn parse_seq<T: copy>(bra: token::token, ket: token::token, sep: seq_sep, f: block(parser) -> T, p: parser) -> spanned<[T]> { let lo = p.get_lo_pos(); @@ -1700,8 +1700,6 @@ fn parse_block_tail(p: parser, lo: uint, s: ast::blk_check_mode) -> ast::blk { fn parse_ty_param(p: parser) -> ast::ty_param { let bounds = []; - if eat_word(p, "send") { bounds += [ast::bound_send]; } - else if eat_word(p, "copy") { bounds += [ast::bound_copy]; } let ident = parse_ident(p); if eat(p, token::COLON) { while p.peek() != token::COMMA && p.peek() != token::GT { diff --git a/src/comp/syntax/util/interner.rs b/src/comp/syntax/util/interner.rs index 2c1589085f2..ab411baaf5a 100644 --- a/src/comp/syntax/util/interner.rs +++ b/src/comp/syntax/util/interner.rs @@ -12,12 +12,12 @@ type interner<T> = hasher: hashfn<T>, eqer: eqfn<T>}; -fn mk<copy T>(hasher: hashfn<T>, eqer: eqfn<T>) -> interner<T> { +fn mk<T: copy>(hasher: hashfn<T>, eqer: eqfn<T>) -> interner<T> { let m = map::mk_hashmap::<T, uint>(hasher, eqer); ret {map: m, mutable vect: [], hasher: hasher, eqer: eqer}; } -fn intern<copy T>(itr: interner<T>, val: T) -> uint { +fn intern<T: copy>(itr: interner<T>, val: T) -> uint { alt itr.map.find(val) { some(idx) { ret idx; } none. { @@ -32,7 +32,7 @@ fn intern<copy T>(itr: interner<T>, val: T) -> uint { // |get| isn't "pure" in the traditional sense, because it can go from // failing to returning a value as items are interned. But for typestate, // where we first check a pred and then rely on it, ceasing to fail is ok. -pure fn get<copy T>(itr: interner<T>, idx: uint) -> T { +pure fn get<T: copy>(itr: interner<T>, idx: uint) -> T { unchecked { itr.vect[idx] } |
