mirror of https://github.com/rust-lang/rust.git
rustc: Make the pretty printer output commas after enum variants. Update all tests accordingly.
This commit is contained in:
parent
c6278e53dc
commit
59ebe6af18
|
@ -451,7 +451,7 @@ fn print_item(s: ps, &&item: @ast::item) {
|
||||||
}
|
}
|
||||||
_ {}
|
_ {}
|
||||||
}
|
}
|
||||||
word(s.s, ";");
|
word(s.s, ",");
|
||||||
end(s);
|
end(s);
|
||||||
maybe_print_trailing_comment(s, v.span, none::<uint>);
|
maybe_print_trailing_comment(s, v.span, none::<uint>);
|
||||||
}
|
}
|
||||||
|
|
|
@ -8,7 +8,7 @@ use std;
|
||||||
import int;
|
import int;
|
||||||
import str;
|
import str;
|
||||||
|
|
||||||
enum bottle { none; dual; single; multiple(int); }
|
enum bottle { none, dual, single, multiple(int), }
|
||||||
|
|
||||||
fn show(b: bottle) {
|
fn show(b: bottle) {
|
||||||
alt b {
|
alt b {
|
||||||
|
|
|
@ -1,7 +1,7 @@
|
||||||
use std;
|
use std;
|
||||||
import int;
|
import int;
|
||||||
|
|
||||||
enum tree { nil; node(~tree, ~tree, int); }
|
enum tree { nil, node(~tree, ~tree, int), }
|
||||||
|
|
||||||
fn item_check(t: ~tree) -> int {
|
fn item_check(t: ~tree) -> int {
|
||||||
alt *t {
|
alt *t {
|
||||||
|
|
|
@ -25,7 +25,7 @@ export grid_t, read_grid, solve_grid, write_grid;
|
||||||
type grid = [[mutable u8]];
|
type grid = [[mutable u8]];
|
||||||
|
|
||||||
// exported type of sudoku grids
|
// exported type of sudoku grids
|
||||||
enum grid_t { grid_ctor(grid); }
|
enum grid_t { grid_ctor(grid), }
|
||||||
|
|
||||||
// read a sudoku problem from file f
|
// read a sudoku problem from file f
|
||||||
fn read_grid(f: io::reader) -> grid_t {
|
fn read_grid(f: io::reader) -> grid_t {
|
||||||
|
|
|
@ -52,11 +52,11 @@ mod map_reduce {
|
||||||
type reducer = fn@(str, getter);
|
type reducer = fn@(str, getter);
|
||||||
|
|
||||||
enum ctrl_proto {
|
enum ctrl_proto {
|
||||||
find_reducer(str, chan<chan<reduce_proto>>);
|
find_reducer(str, chan<chan<reduce_proto>>),
|
||||||
mapper_done;
|
mapper_done,
|
||||||
}
|
}
|
||||||
|
|
||||||
enum reduce_proto { emit_val(int); done; ref; release; }
|
enum reduce_proto { emit_val(int), done, ref, release, }
|
||||||
|
|
||||||
fn start_mappers(ctrl: chan<ctrl_proto>, -inputs: [str]) ->
|
fn start_mappers(ctrl: chan<ctrl_proto>, -inputs: [str]) ->
|
||||||
[joinable_task] {
|
[joinable_task] {
|
||||||
|
|
|
@ -1,7 +1,7 @@
|
||||||
// error-pattern: mismatched types
|
// error-pattern: mismatched types
|
||||||
|
|
||||||
enum a { A; }
|
enum a { A, }
|
||||||
enum b { B; }
|
enum b { B, }
|
||||||
|
|
||||||
fn main() { let x: a = A; alt x { B { } } }
|
fn main() { let x: a = A; alt x { B { } } }
|
||||||
|
|
||||||
|
|
|
@ -1,7 +1,7 @@
|
||||||
// error-pattern: mismatched types
|
// error-pattern: mismatched types
|
||||||
|
|
||||||
enum a { A(int); }
|
enum a { A(int), }
|
||||||
enum b { B(int); }
|
enum b { B(int), }
|
||||||
|
|
||||||
fn main() { let x: a = A(0); alt x { B(y) { } } }
|
fn main() { let x: a = A(0); alt x { B(y) { } } }
|
||||||
|
|
||||||
|
|
|
@ -2,7 +2,7 @@
|
||||||
|
|
||||||
// error-pattern: unresolved
|
// error-pattern: unresolved
|
||||||
|
|
||||||
enum color { rgb(int, int, int); rgba(int, int, int, int); }
|
enum color { rgb(int, int, int), rgba(int, int, int, int), }
|
||||||
|
|
||||||
fn main() {
|
fn main() {
|
||||||
let red: color = rgb(255, 0, 0);
|
let red: color = rgb(255, 0, 0);
|
||||||
|
|
|
@ -6,7 +6,7 @@
|
||||||
mod foo {
|
mod foo {
|
||||||
export t;
|
export t;
|
||||||
|
|
||||||
enum t { t1; }
|
enum t { t1, }
|
||||||
}
|
}
|
||||||
|
|
||||||
fn main() { let x = foo::t1; }
|
fn main() { let x = foo::t1; }
|
||||||
|
|
|
@ -5,7 +5,7 @@ mod foo {
|
||||||
|
|
||||||
fn x() { }
|
fn x() { }
|
||||||
|
|
||||||
enum y { y1; }
|
enum y { y1, }
|
||||||
}
|
}
|
||||||
|
|
||||||
fn main() { let z = foo::y1; }
|
fn main() { let z = foo::y1; }
|
||||||
|
|
|
@ -3,6 +3,6 @@
|
||||||
|
|
||||||
// error-pattern: enum of infinite size
|
// error-pattern: enum of infinite size
|
||||||
|
|
||||||
enum mlist { cons(int, mlist); nil; }
|
enum mlist { cons(int, mlist), nil, }
|
||||||
|
|
||||||
fn main() { let a = cons(10, cons(11, nil)); }
|
fn main() { let a = cons(10, cons(11, nil)); }
|
|
@ -1,6 +1,6 @@
|
||||||
// error-pattern:refutable pattern
|
// error-pattern:refutable pattern
|
||||||
|
|
||||||
enum xx { xx(int); yy; }
|
enum xx { xx(int), yy, }
|
||||||
|
|
||||||
fn main() {
|
fn main() {
|
||||||
let @{x: xx(x), y: y} = @{x: xx(10), y: 20};
|
let @{x: xx(x), y: y} = @{x: xx(10), y: 20};
|
||||||
|
|
|
@ -1,5 +1,5 @@
|
||||||
// error-pattern:Declaration of thpppt shadows
|
// error-pattern:Declaration of thpppt shadows
|
||||||
enum ack { thpppt; ffff; }
|
enum ack { thpppt, ffff, }
|
||||||
|
|
||||||
fn main() {
|
fn main() {
|
||||||
let thpppt: int = 42;
|
let thpppt: int = 42;
|
||||||
|
|
|
@ -1,4 +1,4 @@
|
||||||
// error-pattern:mismatched types
|
// error-pattern:mismatched types
|
||||||
// From Issue #778
|
// From Issue #778
|
||||||
enum clam<T> { a(T); }
|
enum clam<T> { a(T), }
|
||||||
fn main() { let c; c = a(c); alt c { a::<int>(_) { } } }
|
fn main() { let c; c = a(c); alt c { a::<int>(_) { } } }
|
||||||
|
|
|
@ -1,5 +1,5 @@
|
||||||
// error-pattern: mismatched types
|
// error-pattern: mismatched types
|
||||||
|
|
||||||
enum blah { a(int, int, uint); b(int, int); }
|
enum blah { a(int, int, uint), b(int, int), }
|
||||||
|
|
||||||
fn main() { alt a(1, 1, 2u) { a(_, x, y) | b(x, y) { } } }
|
fn main() { alt a(1, 1, 2u) { a(_, x, y) | b(x, y) { } } }
|
||||||
|
|
|
@ -6,7 +6,7 @@ import option::some;
|
||||||
|
|
||||||
// error-pattern: mismatched types
|
// error-pattern: mismatched types
|
||||||
|
|
||||||
enum bar { t1((), option::t<[int]>); t2; }
|
enum bar { t1((), option::t<[int]>), t2, }
|
||||||
|
|
||||||
fn foo(t: bar) -> int { alt t { t1(_, some(x)) { ret x * 3; } _ { fail; } } }
|
fn foo(t: bar) -> int { alt t { t1(_, some(x)) { ret x * 3; } _ { fail; } } }
|
||||||
|
|
||||||
|
|
|
@ -5,7 +5,7 @@ import option::some;
|
||||||
|
|
||||||
// error-pattern: mismatched types
|
// error-pattern: mismatched types
|
||||||
|
|
||||||
enum bar { t1((), option::t<[int]>); t2; }
|
enum bar { t1((), option::t<[int]>), t2, }
|
||||||
|
|
||||||
fn foo(t: bar) {
|
fn foo(t: bar) {
|
||||||
alt t {
|
alt t {
|
||||||
|
|
|
@ -1,8 +1,8 @@
|
||||||
//error-pattern: non-scalar cast
|
//error-pattern: non-scalar cast
|
||||||
|
|
||||||
enum non_nullary {
|
enum non_nullary {
|
||||||
nullary;
|
nullary,
|
||||||
other(int);
|
other(int),
|
||||||
}
|
}
|
||||||
|
|
||||||
fn main() {
|
fn main() {
|
||||||
|
|
|
@ -3,9 +3,9 @@
|
||||||
// black and white have the same discriminator value ...
|
// black and white have the same discriminator value ...
|
||||||
|
|
||||||
enum color {
|
enum color {
|
||||||
red = 0xff0000;
|
red = 0xff0000,
|
||||||
green = 0x00ff00;
|
green = 0x00ff00,
|
||||||
blue = 0x0000ff;
|
blue = 0x0000ff,
|
||||||
black = 0x000000;
|
black = 0x000000,
|
||||||
white = 0x000000;
|
white = 0x000000,
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,10 +1,10 @@
|
||||||
//error-pattern: discriminator values can only be used with a c-like enum
|
//error-pattern: discriminator values can only be used with a c-like enum
|
||||||
|
|
||||||
enum color {
|
enum color {
|
||||||
red = 0xff0000;
|
red = 0xff0000,
|
||||||
green = 0x00ff00;
|
green = 0x00ff00,
|
||||||
blue = 0x0000ff;
|
blue = 0x0000ff,
|
||||||
black = 0x000000;
|
black = 0x000000,
|
||||||
white = 0xffffff;
|
white = 0xffffff,
|
||||||
other (str);
|
other (str),
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,8 +1,8 @@
|
||||||
//error-pattern: mismatched types
|
//error-pattern: mismatched types
|
||||||
|
|
||||||
enum color {
|
enum color {
|
||||||
red = 1u;
|
red = 1u,
|
||||||
blue = 2;
|
blue = 2,
|
||||||
}
|
}
|
||||||
|
|
||||||
fn main() {}
|
fn main() {}
|
||||||
|
|
|
@ -1,5 +1,5 @@
|
||||||
// error-pattern:unreachable pattern
|
// error-pattern:unreachable pattern
|
||||||
|
|
||||||
enum foo { a(@foo, int); b(uint); }
|
enum foo { a(@foo, int), b(uint), }
|
||||||
|
|
||||||
fn main() { alt b(1u) { b(_) | a(@_, 1) { } a(_, 1) { } } }
|
fn main() { alt b(1u) { b(_) | a(@_, 1) { } a(_, 1) { } } }
|
||||||
|
|
|
@ -1,8 +1,8 @@
|
||||||
// pp-exact
|
// pp-exact
|
||||||
|
|
||||||
enum foo {
|
enum foo {
|
||||||
foo; // a foo.
|
foo, // a foo.
|
||||||
bar;
|
bar,
|
||||||
}
|
}
|
||||||
|
|
||||||
fn main() { }
|
fn main() { }
|
||||||
|
|
|
@ -4,6 +4,6 @@
|
||||||
// -*- rust -*-
|
// -*- rust -*-
|
||||||
|
|
||||||
// error-pattern:non-exhaustive match failure
|
// error-pattern:non-exhaustive match failure
|
||||||
enum t { a; b; }
|
enum t { a, b, }
|
||||||
|
|
||||||
fn main() { let x = a; alt x { b { } } }
|
fn main() { let x = a; alt x { b { } } }
|
||||||
|
|
|
@ -5,7 +5,7 @@ use std;
|
||||||
import option;
|
import option;
|
||||||
import option::none;
|
import option::none;
|
||||||
|
|
||||||
enum sty { ty_nil; }
|
enum sty { ty_nil, }
|
||||||
|
|
||||||
type raw_t = {struct: sty, cname: option::t<str>, hash: uint};
|
type raw_t = {struct: sty, cname: option::t<str>, hash: uint};
|
||||||
|
|
||||||
|
|
|
@ -1,4 +1,4 @@
|
||||||
enum option<T> { some(T); none; }
|
enum option<T> { some(T), none, }
|
||||||
|
|
||||||
type r<T> = {mutable v: [option<T>]};
|
type r<T> = {mutable v: [option<T>]};
|
||||||
|
|
||||||
|
|
|
@ -1,7 +1,7 @@
|
||||||
|
|
||||||
|
|
||||||
mod m1 {
|
mod m1 {
|
||||||
enum foo { foo1; foo2; }
|
enum foo { foo1, foo2, }
|
||||||
}
|
}
|
||||||
|
|
||||||
fn bar(x: m1::foo) { alt x { m1::foo1 { } } }
|
fn bar(x: m1::foo) { alt x { m1::foo1 { } } }
|
||||||
|
|
|
@ -5,7 +5,7 @@ use std;
|
||||||
|
|
||||||
import std::dbg;
|
import std::dbg;
|
||||||
|
|
||||||
enum t { make_t(@int); clam; }
|
enum t { make_t(@int), clam, }
|
||||||
|
|
||||||
fn foo(s: @int) {
|
fn foo(s: @int) {
|
||||||
let count = dbg::refcount(s);
|
let count = dbg::refcount(s);
|
||||||
|
|
|
@ -1,4 +1,4 @@
|
||||||
enum maybe<T> { nothing; just(T); }
|
enum maybe<T> { nothing, just(T), }
|
||||||
|
|
||||||
fn foo(x: maybe<int>) {
|
fn foo(x: maybe<int>) {
|
||||||
alt x { nothing { #error("A"); } just(a) { #error("B"); } }
|
alt x { nothing { #error("A"); } just(a) { #error("B"); } }
|
||||||
|
|
|
@ -1,6 +1,6 @@
|
||||||
|
|
||||||
|
|
||||||
enum thing { a; b; c; }
|
enum thing { a, b, c, }
|
||||||
|
|
||||||
fn foo(it: block(int)) { it(10); }
|
fn foo(it: block(int)) { it(10); }
|
||||||
|
|
||||||
|
|
|
@ -3,7 +3,7 @@
|
||||||
fn main() {
|
fn main() {
|
||||||
alt "test" { "not-test" { fail; } "test" { } _ { fail; } }
|
alt "test" { "not-test" { fail; } "test" { } _ { fail; } }
|
||||||
|
|
||||||
enum t { tag1(str); tag2; }
|
enum t { tag1(str), tag2, }
|
||||||
|
|
||||||
|
|
||||||
alt tag1("test") {
|
alt tag1("test") {
|
||||||
|
|
|
@ -3,9 +3,9 @@
|
||||||
|
|
||||||
// -*- rust -*-
|
// -*- rust -*-
|
||||||
enum color {
|
enum color {
|
||||||
rgb(int, int, int);
|
rgb(int, int, int),
|
||||||
rgba(int, int, int, int);
|
rgba(int, int, int, int),
|
||||||
hsl(int, int, int);
|
hsl(int, int, int),
|
||||||
}
|
}
|
||||||
|
|
||||||
fn process(c: color) -> int {
|
fn process(c: color) -> int {
|
||||||
|
|
|
@ -1,5 +1,5 @@
|
||||||
type foo = {a: int, b: uint};
|
type foo = {a: int, b: uint};
|
||||||
enum bar { u(@foo); w(int); }
|
enum bar { u(@foo), w(int), }
|
||||||
|
|
||||||
fn main() {
|
fn main() {
|
||||||
assert (alt u(@{a: 10, b: 40u}) {
|
assert (alt u(@{a: 10, b: 40u}) {
|
||||||
|
|
|
@ -8,7 +8,7 @@ import comm;
|
||||||
import comm::port;
|
import comm::port;
|
||||||
import comm::recv;
|
import comm::recv;
|
||||||
|
|
||||||
enum request { quit; close(chan<bool>); }
|
enum request { quit, close(chan<bool>), }
|
||||||
|
|
||||||
type ctx = chan<request>;
|
type ctx = chan<request>;
|
||||||
|
|
||||||
|
|
|
@ -20,9 +20,9 @@ type t = int;
|
||||||
type t = bool;
|
type t = bool;
|
||||||
|
|
||||||
#[cfg(bogus)]
|
#[cfg(bogus)]
|
||||||
enum tg { foo; }
|
enum tg { foo, }
|
||||||
|
|
||||||
enum tg { bar; }
|
enum tg { bar, }
|
||||||
|
|
||||||
#[cfg(bogus)]
|
#[cfg(bogus)]
|
||||||
resource r(i: int) { }
|
resource r(i: int) { }
|
||||||
|
|
|
@ -1,6 +1,6 @@
|
||||||
// -*- rust -*-
|
// -*- rust -*-
|
||||||
|
|
||||||
enum list { cons(int, @list); nil; }
|
enum list { cons(int, @list), nil, }
|
||||||
|
|
||||||
type bubu = {x: int, y: int};
|
type bubu = {x: int, y: int};
|
||||||
|
|
||||||
|
|
|
@ -1,6 +1,6 @@
|
||||||
enum taggy {
|
enum taggy {
|
||||||
cons(@mutable taggy);
|
cons(@mutable taggy),
|
||||||
nil;
|
nil,
|
||||||
}
|
}
|
||||||
|
|
||||||
fn f() {
|
fn f() {
|
||||||
|
|
|
@ -1,5 +1,5 @@
|
||||||
|
|
||||||
|
|
||||||
enum t { foo(@int); }
|
enum t { foo(@int), }
|
||||||
|
|
||||||
fn main() { let tt = foo(@10); alt tt { foo(z) { } } }
|
fn main() { let tt = foo(@10); alt tt { foo(z) { } } }
|
||||||
|
|
|
@ -1,4 +1,4 @@
|
||||||
enum chan { chan_t; }
|
enum chan { chan_t, }
|
||||||
|
|
||||||
fn wrapper3(i: chan) {
|
fn wrapper3(i: chan) {
|
||||||
assert i == chan_t;
|
assert i == chan_t;
|
||||||
|
|
|
@ -1,6 +1,6 @@
|
||||||
// pp-exact
|
// pp-exact
|
||||||
|
|
||||||
enum color { red = 1; green; blue; imaginary = -1; }
|
enum color { red = 1, green, blue, imaginary = -1, }
|
||||||
|
|
||||||
fn main() {
|
fn main() {
|
||||||
test_color(red, 1, "red");
|
test_color(red, 1, "red");
|
||||||
|
|
|
@ -5,7 +5,7 @@ mod foo {
|
||||||
export t;
|
export t;
|
||||||
export f;
|
export f;
|
||||||
|
|
||||||
enum t { t1; }
|
enum t { t1, }
|
||||||
|
|
||||||
fn f() -> t { ret t1; }
|
fn f() -> t { ret t1; }
|
||||||
}
|
}
|
||||||
|
|
|
@ -2,6 +2,6 @@
|
||||||
export foo;
|
export foo;
|
||||||
export main;
|
export main;
|
||||||
|
|
||||||
enum list_cell<T> { cons(@list_cell<T>); }
|
enum list_cell<T> { cons(@list_cell<T>), }
|
||||||
|
|
||||||
fn main() { }
|
fn main() { }
|
||||||
|
|
|
@ -2,7 +2,7 @@
|
||||||
|
|
||||||
mod foo {
|
mod foo {
|
||||||
export t1;
|
export t1;
|
||||||
enum t { t1; }
|
enum t { t1, }
|
||||||
}
|
}
|
||||||
|
|
||||||
fn main() { let v = foo::t1; }
|
fn main() { let v = foo::t1; }
|
||||||
|
|
|
@ -6,7 +6,7 @@ mod foo {
|
||||||
export g;
|
export g;
|
||||||
|
|
||||||
// not exported
|
// not exported
|
||||||
enum t { t1; t2; }
|
enum t { t1, t2, }
|
||||||
|
|
||||||
fn f() -> t { ret t1; }
|
fn f() -> t { ret t1; }
|
||||||
|
|
||||||
|
|
|
@ -10,7 +10,7 @@ fn test_rec() {
|
||||||
}
|
}
|
||||||
|
|
||||||
fn test_tag() {
|
fn test_tag() {
|
||||||
enum mood { happy; sad; }
|
enum mood { happy, sad, }
|
||||||
let rs = alt true { true { happy } false { sad } };
|
let rs = alt true { true { happy } false { sad } };
|
||||||
assert (rs == happy);
|
assert (rs == happy);
|
||||||
}
|
}
|
||||||
|
|
|
@ -10,7 +10,7 @@ fn test_rec() {
|
||||||
}
|
}
|
||||||
|
|
||||||
fn test_tag() {
|
fn test_tag() {
|
||||||
enum mood { happy; sad; }
|
enum mood { happy, sad, }
|
||||||
let rs = if true { happy } else { sad };
|
let rs = if true { happy } else { sad };
|
||||||
assert (rs == happy);
|
assert (rs == happy);
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,4 +1,4 @@
|
||||||
enum wrapper<T> { wrapped(T); }
|
enum wrapper<T> { wrapped(T), }
|
||||||
|
|
||||||
fn main() { let w = wrapped([1, 2, 3, 4, 5]); }
|
fn main() { let w = wrapped([1, 2, 3, 4, 5]); }
|
||||||
|
|
||||||
|
|
|
@ -1,6 +1,6 @@
|
||||||
|
|
||||||
|
|
||||||
enum list<T> { cons(@T, @list<T>); nil; }
|
enum list<T> { cons(@T, @list<T>), nil, }
|
||||||
|
|
||||||
fn main() {
|
fn main() {
|
||||||
let a: list<int> =
|
let a: list<int> =
|
||||||
|
|
|
@ -1,6 +1,6 @@
|
||||||
|
|
||||||
|
|
||||||
enum foo<T> { arm(T); }
|
enum foo<T> { arm(T), }
|
||||||
|
|
||||||
fn altfoo<T>(f: foo<T>) {
|
fn altfoo<T>(f: foo<T>) {
|
||||||
let hit = false;
|
let hit = false;
|
||||||
|
|
|
@ -2,6 +2,6 @@
|
||||||
|
|
||||||
|
|
||||||
// This causes memory corruption in stage0.
|
// This causes memory corruption in stage0.
|
||||||
enum thing<K> { some(K); }
|
enum thing<K> { some(K), }
|
||||||
|
|
||||||
fn main() { let x = some("hi"); }
|
fn main() { let x = some("hi"); }
|
||||||
|
|
|
@ -1,5 +1,5 @@
|
||||||
|
|
||||||
|
|
||||||
enum clam<T> { a(T); }
|
enum clam<T> { a(T), }
|
||||||
|
|
||||||
fn main() { let c = a(3); }
|
fn main() { let c = a(3); }
|
||||||
|
|
|
@ -2,7 +2,7 @@
|
||||||
|
|
||||||
|
|
||||||
// -*- rust -*-
|
// -*- rust -*-
|
||||||
enum noption<T> { some(T); }
|
enum noption<T> { some(T), }
|
||||||
|
|
||||||
fn main() {
|
fn main() {
|
||||||
let nop: noption<int> = some::<int>(5);
|
let nop: noption<int> = some::<int>(5);
|
||||||
|
|
|
@ -1,5 +1,5 @@
|
||||||
|
|
||||||
|
|
||||||
enum option<T> { some(@T); none; }
|
enum option<T> { some(@T), none, }
|
||||||
|
|
||||||
fn main() { let a: option<int> = some::<int>(@10); a = none::<int>; }
|
fn main() { let a: option<int> = some::<int>(@10); a = none::<int>; }
|
||||||
|
|
|
@ -30,7 +30,7 @@ mod map_reduce {
|
||||||
|
|
||||||
type mapper = native fn(str, putter);
|
type mapper = native fn(str, putter);
|
||||||
|
|
||||||
enum ctrl_proto { find_reducer([u8], chan<int>); mapper_done; }
|
enum ctrl_proto { find_reducer([u8], chan<int>), mapper_done, }
|
||||||
|
|
||||||
fn start_mappers(ctrl: chan<ctrl_proto>, inputs: [str]) {
|
fn start_mappers(ctrl: chan<ctrl_proto>, inputs: [str]) {
|
||||||
for i: str in inputs {
|
for i: str in inputs {
|
||||||
|
|
|
@ -23,7 +23,7 @@ fn test_rec() {
|
||||||
|
|
||||||
fn test_tag() {
|
fn test_tag() {
|
||||||
enum t {
|
enum t {
|
||||||
t0(r);
|
t0(r),
|
||||||
}
|
}
|
||||||
|
|
||||||
let i = @mutable 0;
|
let i = @mutable 0;
|
||||||
|
|
|
@ -7,7 +7,7 @@ import comm::port;
|
||||||
import comm::recv;
|
import comm::recv;
|
||||||
import comm::send;
|
import comm::send;
|
||||||
|
|
||||||
enum msg { closed; received([u8]); }
|
enum msg { closed, received([u8]), }
|
||||||
|
|
||||||
fn producer(c: chan<[u8]>) {
|
fn producer(c: chan<[u8]>) {
|
||||||
send(c, [1u8, 2u8, 3u8, 4u8]);
|
send(c, [1u8, 2u8, 3u8, 4u8]);
|
||||||
|
|
|
@ -1,6 +1,6 @@
|
||||||
enum maybe_pointy {
|
enum maybe_pointy {
|
||||||
no_pointy;
|
no_pointy,
|
||||||
yes_pointy(@pointy);
|
yes_pointy(@pointy),
|
||||||
}
|
}
|
||||||
|
|
||||||
type pointy = {
|
type pointy = {
|
||||||
|
|
|
@ -1,5 +1,5 @@
|
||||||
|
|
||||||
|
|
||||||
enum t { a; b(@int); }
|
enum t { a, b(@int), }
|
||||||
|
|
||||||
fn main() { let x = b(@10); x = a; }
|
fn main() { let x = b(@10); x = a; }
|
||||||
|
|
|
@ -2,6 +2,6 @@
|
||||||
|
|
||||||
|
|
||||||
// -*- rust -*-
|
// -*- rust -*-
|
||||||
enum list { cons(int, @list); nil; }
|
enum list { cons(int, @list), nil, }
|
||||||
|
|
||||||
fn main() { cons(10, @cons(11, @cons(12, @nil))); }
|
fn main() { cons(10, @cons(11, @cons(12, @nil))); }
|
||||||
|
|
|
@ -2,8 +2,8 @@ use std;
|
||||||
import std::list;
|
import std::list;
|
||||||
|
|
||||||
enum foo {
|
enum foo {
|
||||||
a(uint);
|
a(uint),
|
||||||
b(str);
|
b(str),
|
||||||
}
|
}
|
||||||
|
|
||||||
fn check_log<T>(exp: str, v: T) {
|
fn check_log<T>(exp: str, v: T) {
|
||||||
|
|
|
@ -1,7 +1,7 @@
|
||||||
enum foo {
|
enum foo {
|
||||||
a(uint);
|
a(uint),
|
||||||
b(str);
|
b(str),
|
||||||
c;
|
c,
|
||||||
}
|
}
|
||||||
|
|
||||||
fn main() {
|
fn main() {
|
||||||
|
|
|
@ -1,8 +1,8 @@
|
||||||
// Tests that shapes respect linearize_ty_params().
|
// Tests that shapes respect linearize_ty_params().
|
||||||
|
|
||||||
enum option<T> {
|
enum option<T> {
|
||||||
none;
|
none,
|
||||||
some(T);
|
some(T),
|
||||||
}
|
}
|
||||||
|
|
||||||
type smallintmap<T> = @{mutable v: [mutable option<T>]};
|
type smallintmap<T> = @{mutable v: [mutable option<T>]};
|
||||||
|
|
|
@ -4,7 +4,7 @@ use std;
|
||||||
|
|
||||||
type cell = {mutable c: @list};
|
type cell = {mutable c: @list};
|
||||||
|
|
||||||
enum list { link(@cell); nil; }
|
enum list { link(@cell), nil, }
|
||||||
|
|
||||||
fn main() {
|
fn main() {
|
||||||
let first: @cell = @{mutable c: @nil()};
|
let first: @cell = @{mutable c: @nil()};
|
||||||
|
|
|
@ -1,4 +1,4 @@
|
||||||
// -*- rust -*-
|
// -*- rust -*-
|
||||||
enum mlist { cons(int, @mlist); nil; }
|
enum mlist { cons(int, @mlist), nil, }
|
||||||
|
|
||||||
fn main() { cons(10, @cons(11, @cons(12, @nil))); }
|
fn main() { cons(10, @cons(11, @cons(12, @nil))); }
|
||||||
|
|
|
@ -2,12 +2,12 @@
|
||||||
|
|
||||||
|
|
||||||
// -*- rust -*-
|
// -*- rust -*-
|
||||||
enum colour { red; green; blue; }
|
enum colour { red, green, blue, }
|
||||||
|
|
||||||
enum tree { children(@list); leaf(colour); }
|
enum tree { children(@list), leaf(colour), }
|
||||||
|
|
||||||
enum list { cons(@tree, @list); nil; }
|
enum list { cons(@tree, @list), nil, }
|
||||||
|
|
||||||
enum small_list { kons(int, @small_list); neel; }
|
enum small_list { kons(int, @small_list), neel, }
|
||||||
|
|
||||||
fn main() { }
|
fn main() { }
|
||||||
|
|
|
@ -6,7 +6,7 @@ import option;
|
||||||
import option::some;
|
import option::some;
|
||||||
import option::none;
|
import option::none;
|
||||||
|
|
||||||
enum t { foo(int, uint); bar(int, option::t<int>); }
|
enum t { foo(int, uint), bar(int, option::t<int>), }
|
||||||
|
|
||||||
fn nested(o: t) {
|
fn nested(o: t) {
|
||||||
alt o {
|
alt o {
|
||||||
|
|
|
@ -1,4 +1,4 @@
|
||||||
enum blah { a; b; }
|
enum blah { a, b, }
|
||||||
|
|
||||||
fn or_alt(q: blah) -> int {
|
fn or_alt(q: blah) -> int {
|
||||||
alt q { a | b { 42 } }
|
alt q { a | b { 42 } }
|
||||||
|
|
|
@ -1,4 +1,4 @@
|
||||||
enum blah { a(int, int, uint); b(int, int); c; }
|
enum blah { a(int, int, uint), b(int, int), c, }
|
||||||
|
|
||||||
fn or_alt(q: blah) -> int {
|
fn or_alt(q: blah) -> int {
|
||||||
alt q { a(x, y, _) | b(x, y) { ret x + y; } c { ret 0; } }
|
alt q { a(x, y, _) | b(x, y) { ret x + y; } c { ret 0; } }
|
||||||
|
|
|
@ -1,6 +1,6 @@
|
||||||
enum t1 { a(int); b(uint); }
|
enum t1 { a(int), b(uint), }
|
||||||
type t2 = {x: t1, y: int};
|
type t2 = {x: t1, y: int};
|
||||||
enum t3 { c(t2, uint); }
|
enum t3 { c(t2, uint), }
|
||||||
|
|
||||||
fn m(in: t3) -> int {
|
fn m(in: t3) -> int {
|
||||||
alt in {
|
alt in {
|
||||||
|
|
|
@ -5,7 +5,7 @@ type closable = @mutable bool;
|
||||||
|
|
||||||
resource close_res(i: closable) { *i = false; }
|
resource close_res(i: closable) { *i = false; }
|
||||||
|
|
||||||
enum option<T> { none; some(T); }
|
enum option<T> { none, some(T), }
|
||||||
|
|
||||||
fn sink(res: option<close_res>) { }
|
fn sink(res: option<close_res>) { }
|
||||||
|
|
||||||
|
|
|
@ -1,6 +1,6 @@
|
||||||
|
|
||||||
|
|
||||||
enum option<T> { none; some(T); }
|
enum option<T> { none, some(T), }
|
||||||
|
|
||||||
fn f<T: copy>() -> option<T> { ret none; }
|
fn f<T: copy>() -> option<T> { ret none; }
|
||||||
|
|
||||||
|
|
|
@ -16,6 +16,6 @@ fn foo(c: [int]) {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
enum t<T> { none; some(T); }
|
enum t<T> { none, some(T), }
|
||||||
|
|
||||||
fn main() { let x = 10; let x = x + 20; assert (x == 30); foo([]); }
|
fn main() { let x = 10; let x = x + 20; assert (x == 30); foo([]); }
|
||||||
|
|
|
@ -10,8 +10,8 @@ import option;
|
||||||
enum opt_span {
|
enum opt_span {
|
||||||
|
|
||||||
//hack (as opposed to option::t), to make `span` compile
|
//hack (as opposed to option::t), to make `span` compile
|
||||||
os_none;
|
os_none,
|
||||||
os_some(@span);
|
os_some(@span),
|
||||||
}
|
}
|
||||||
type span = {lo: uint, hi: uint, expanded_from: opt_span};
|
type span = {lo: uint, hi: uint, expanded_from: opt_span};
|
||||||
type spanned<T> = { data: T, span: span };
|
type spanned<T> = { data: T, span: span };
|
||||||
|
|
|
@ -1,6 +1,6 @@
|
||||||
|
|
||||||
|
|
||||||
enum opt<T> { none; }
|
enum opt<T> { none, }
|
||||||
|
|
||||||
fn main() {
|
fn main() {
|
||||||
let x = none::<int>;
|
let x = none::<int>;
|
||||||
|
|
|
@ -1,5 +1,5 @@
|
||||||
|
|
||||||
|
|
||||||
enum clam<T> { a(T); }
|
enum clam<T> { a(T), }
|
||||||
|
|
||||||
fn main() { let c = a(2); alt c { a::<int>(_) { } } }
|
fn main() { let c = a(2); alt c { a::<int>(_) { } } }
|
||||||
|
|
|
@ -1,5 +1,5 @@
|
||||||
|
|
||||||
|
|
||||||
enum clam<T> { a(T); }
|
enum clam<T> { a(T), }
|
||||||
|
|
||||||
fn main() { }
|
fn main() { }
|
||||||
|
|
|
@ -2,7 +2,7 @@
|
||||||
|
|
||||||
|
|
||||||
// -*- rust -*-
|
// -*- rust -*-
|
||||||
enum clam<T> { a(T, int); b; }
|
enum clam<T> { a(T, int), b, }
|
||||||
|
|
||||||
fn uhoh<T>(v: [clam<T>]) {
|
fn uhoh<T>(v: [clam<T>]) {
|
||||||
alt v[1] {
|
alt v[1] {
|
||||||
|
|
|
@ -1,5 +1,5 @@
|
||||||
|
|
||||||
|
|
||||||
enum taggy { foo(@taggy); bar; }
|
enum taggy { foo(@taggy), bar, }
|
||||||
|
|
||||||
fn main() { assert (bar <= bar); }
|
fn main() { assert (bar <= bar); }
|
||||||
|
|
|
@ -1,6 +1,6 @@
|
||||||
|
|
||||||
|
|
||||||
enum foo { large; small; }
|
enum foo { large, small, }
|
||||||
|
|
||||||
fn main() {
|
fn main() {
|
||||||
let a = {x: 1, y: 2, z: 3};
|
let a = {x: 1, y: 2, z: 3};
|
||||||
|
|
|
@ -1,6 +1,6 @@
|
||||||
// xfail-test
|
// xfail-test
|
||||||
|
|
||||||
enum color { red; green; blue; black; white; }
|
enum color { red, green, blue, black, white, }
|
||||||
|
|
||||||
fn main() {
|
fn main() {
|
||||||
assert (uint::to_str(red as uint, 10) == #fmt["%?", red]);
|
assert (uint::to_str(red as uint, 10) == #fmt["%?", red]);
|
||||||
|
|
|
@ -1,11 +1,11 @@
|
||||||
// xfail-pretty Issue #1510
|
// xfail-pretty Issue #1510
|
||||||
|
|
||||||
enum color {
|
enum color {
|
||||||
red = 0xff0000;
|
red = 0xff0000,
|
||||||
green = 0x00ff00;
|
green = 0x00ff00,
|
||||||
blue = 0x0000ff;
|
blue = 0x0000ff,
|
||||||
black = 0x000000;
|
black = 0x000000,
|
||||||
white = 0xFFFFFF;
|
white = 0xFFFFFF,
|
||||||
}
|
}
|
||||||
|
|
||||||
fn main() {
|
fn main() {
|
||||||
|
|
|
@ -2,7 +2,7 @@
|
||||||
|
|
||||||
fn foo() {
|
fn foo() {
|
||||||
fn zed(z: bar) { }
|
fn zed(z: bar) { }
|
||||||
enum bar { nil; }
|
enum bar { nil, }
|
||||||
fn baz() { zed(nil); }
|
fn baz() { zed(nil); }
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -1,10 +1,10 @@
|
||||||
enum color {
|
enum color {
|
||||||
red = 0xff0000;
|
red = 0xff0000,
|
||||||
green = 0x00ff00;
|
green = 0x00ff00,
|
||||||
blue = 0x0000ff;
|
blue = 0x0000ff,
|
||||||
black = 0x000000;
|
black = 0x000000,
|
||||||
white = 0xFFFFFF;
|
white = 0xFFFFFF,
|
||||||
imaginary = -1;
|
imaginary = -1,
|
||||||
}
|
}
|
||||||
|
|
||||||
fn main() {
|
fn main() {
|
||||||
|
|
|
@ -2,7 +2,7 @@
|
||||||
|
|
||||||
|
|
||||||
// -*- rust -*-
|
// -*- rust -*-
|
||||||
enum colour { red(int, int); green; }
|
enum colour { red(int, int), green, }
|
||||||
|
|
||||||
fn f() { let x = red(1, 2); let y = green; assert (x != y); }
|
fn f() { let x = red(1, 2); let y = green; assert (x != y); }
|
||||||
|
|
||||||
|
|
|
@ -50,7 +50,7 @@ fn test_str() {
|
||||||
}
|
}
|
||||||
|
|
||||||
fn test_tag() {
|
fn test_tag() {
|
||||||
enum t { tag1; tag2(int); tag3(int, u8, char); }
|
enum t { tag1, tag2(int), tag3(int, u8, char), }
|
||||||
let po = port();
|
let po = port();
|
||||||
let ch = chan(po);
|
let ch = chan(po);
|
||||||
send(ch, tag1);
|
send(ch, tag1);
|
||||||
|
|
|
@ -1,6 +1,6 @@
|
||||||
enum maybe_pointy {
|
enum maybe_pointy {
|
||||||
none;
|
none,
|
||||||
p(@pointy);
|
p(@pointy),
|
||||||
}
|
}
|
||||||
|
|
||||||
type pointy = {
|
type pointy = {
|
||||||
|
|
|
@ -1,6 +1,6 @@
|
||||||
enum maybe_pointy {
|
enum maybe_pointy {
|
||||||
none;
|
none,
|
||||||
p(@pointy);
|
p(@pointy),
|
||||||
}
|
}
|
||||||
|
|
||||||
type pointy = {
|
type pointy = {
|
||||||
|
|
|
@ -1,5 +1,5 @@
|
||||||
fn main() {
|
fn main() {
|
||||||
enum t { t1(int); t2(int); }
|
enum t { t1(int), t2(int), }
|
||||||
|
|
||||||
let x = ~t1(10);
|
let x = ~t1(10);
|
||||||
|
|
||||||
|
|
|
@ -1,5 +1,5 @@
|
||||||
fn test1() {
|
fn test1() {
|
||||||
enum bar { u(~int); w(int); }
|
enum bar { u(~int), w(int), }
|
||||||
|
|
||||||
let x = u(~10);
|
let x = u(~10);
|
||||||
assert alt x {
|
assert alt x {
|
||||||
|
|
|
@ -1,6 +1,6 @@
|
||||||
|
|
||||||
type foo = {a: int, b: uint};
|
type foo = {a: int, b: uint};
|
||||||
enum bar { u(~foo); w(int); }
|
enum bar { u(~foo), w(int), }
|
||||||
|
|
||||||
fn main() {
|
fn main() {
|
||||||
assert (alt u(~{a: 10, b: 40u}) {
|
assert (alt u(~{a: 10, b: 40u}) {
|
||||||
|
|
|
@ -1,5 +1,5 @@
|
||||||
|
|
||||||
enum bar { u(~int); w(int); }
|
enum bar { u(~int), w(int), }
|
||||||
|
|
||||||
fn main() {
|
fn main() {
|
||||||
assert alt u(~10) {
|
assert alt u(~10) {
|
||||||
|
|
|
@ -6,6 +6,6 @@ fn foo<T>(o: myoption<T>) -> int {
|
||||||
ret x;
|
ret x;
|
||||||
}
|
}
|
||||||
|
|
||||||
enum myoption<T> { none; some(T); }
|
enum myoption<T> { none, some(T), }
|
||||||
|
|
||||||
fn main() { log(debug, 5); }
|
fn main() { log(debug, 5); }
|
||||||
|
|
|
@ -6,6 +6,6 @@ fn foo<T>(o: myoption<T>) -> int {
|
||||||
ret x;
|
ret x;
|
||||||
}
|
}
|
||||||
|
|
||||||
enum myoption<T> { none; some(T); }
|
enum myoption<T> { none, some(T), }
|
||||||
|
|
||||||
fn main() { log(debug, 5); }
|
fn main() { log(debug, 5); }
|
||||||
|
|
|
@ -1,5 +1,5 @@
|
||||||
|
|
||||||
enum t { a; b(str); }
|
enum t { a, b(str), }
|
||||||
|
|
||||||
fn make(i: int) -> t {
|
fn make(i: int) -> t {
|
||||||
if i > 10 { ret a; }
|
if i > 10 { ret a; }
|
||||||
|
|
Loading…
Reference in New Issue