diff options
| author | Patrick Walton <pcwalton@mimiga.net> | 2013-01-22 14:37:32 -0800 |
|---|---|---|
| committer | Patrick Walton <pcwalton@mimiga.net> | 2013-01-23 11:15:10 -0800 |
| commit | 778aec998b0a4a34632b22abd8c1cfa599fe78f0 (patch) | |
| tree | 0b9863c18bc8b6d75e5275f62631f80c3a24a02c /src/libsyntax | |
| parent | 1871f3a70baf203e31c7e72b13715924bebd3ad7 (diff) | |
| download | rust-778aec998b0a4a34632b22abd8c1cfa599fe78f0.tar.gz rust-778aec998b0a4a34632b22abd8c1cfa599fe78f0.zip | |
libsyntax: Implement the `+` syntax for multiple trait bounds. r=tjc
Diffstat (limited to 'src/libsyntax')
| -rw-r--r-- | src/libsyntax/parse/parser.rs | 4 | ||||
| -rw-r--r-- | src/libsyntax/print/pprust.rs | 7 |
2 files changed, 11 insertions, 0 deletions
diff --git a/src/libsyntax/parse/parser.rs b/src/libsyntax/parse/parser.rs index 61105f6297d..e1fc23276bc 100644 --- a/src/libsyntax/parse/parser.rs +++ b/src/libsyntax/parse/parser.rs @@ -2531,6 +2531,10 @@ impl Parser { } else { break; } + + if self.eat(token::BINOP(token::PLUS)) { + // Should be `break;` but that isn't backwards compatible. + } } } return @move bounds; diff --git a/src/libsyntax/print/pprust.rs b/src/libsyntax/print/pprust.rs index 31ad0bd6ca8..a0d3a81f867 100644 --- a/src/libsyntax/print/pprust.rs +++ b/src/libsyntax/print/pprust.rs @@ -1791,8 +1791,15 @@ fn print_arg_mode(s: ps, m: ast::mode) { fn print_bounds(s: ps, bounds: @~[ast::ty_param_bound]) { if bounds.is_not_empty() { word(s.s, ~":"); + let mut first = true; for vec::each(*bounds) |&bound| { nbsp(s); + if first { + first = false; + } else { + word_space(s, ~"+"); + } + match bound { TraitTyParamBound(ty) => print_type(s, ty), RegionTyParamBound => word(s.s, ~"&static"), |
