Skip to content

Commit 1e8a15b

Browse files
committed
---
yaml --- r: 38429 b: refs/heads/try c: 79f0d67 h: refs/heads/master i: 38427: 3cf1db2 v: v3
1 parent 653faca commit 1e8a15b

File tree

5 files changed

+68
-2
lines changed

5 files changed

+68
-2
lines changed

[refs]

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
refs/heads/master: 09bb07bed9166105ea961a42b5fff7739ae0d2e9
33
refs/heads/snap-stage1: e33de59e47c5076a89eadeb38f4934f58a3618a6
44
refs/heads/snap-stage3: eb8fd119c65c67f3b1b8268cc7341c22d39b7b61
5-
refs/heads/try: 349fa1e550905577fd9545aada328fb0806cf641
5+
refs/heads/try: 79f0d67d2801f17c143b38926f05a40d0c22f5c0
66
refs/tags/release-0.1: 1f5c5126e96c79d22cb7862f75304136e204f105
77
refs/heads/ndm: f3868061cd7988080c30d6d5bf352a5a5fe2460b
88
refs/heads/try2: a810c03263670238bccd64cabb12a23a46e3a278
Lines changed: 38 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,38 @@
1+
// Copyright 2013 The Rust Project Developers. See the COPYRIGHT
2+
// file at the top-level directory of this distribution and at
3+
// http://rust-lang.org/COPYRIGHT.
4+
//
5+
// Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or
6+
// http://www.apache.org/licenses/LICENSE-2.0> or the MIT license
7+
// <LICENSE-MIT or http://opensource.org/licenses/MIT>, at your
8+
// option. This file may not be copied, modified, or distributed
9+
// except according to those terms.
10+
11+
enum Foo {
12+
Bar(u32),
13+
Baz,
14+
Quux(u64, u16)
15+
}
16+
17+
const X: Foo = Baz;
18+
19+
fn main() {
20+
match X {
21+
Baz => {}
22+
_ => fail
23+
}
24+
match Y {
25+
Bar(s) => assert(s == 2654435769),
26+
_ => fail
27+
}
28+
match Z {
29+
Quux(d,h) => {
30+
assert(d == 0x123456789abcdef0);
31+
assert(h == 0x1234);
32+
}
33+
_ => fail
34+
}
35+
}
36+
37+
const Y: Foo = Bar(2654435769);
38+
const Z: Foo = Quux(0x123456789abcdef0, 0x1234);
Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,20 @@
1+
// Copyright 2013 The Rust Project Developers. See the COPYRIGHT
2+
// file at the top-level directory of this distribution and at
3+
// http://rust-lang.org/COPYRIGHT.
4+
//
5+
// Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or
6+
// http://www.apache.org/licenses/LICENSE-2.0> or the MIT license
7+
// <LICENSE-MIT or http://opensource.org/licenses/MIT>, at your
8+
// option. This file may not be copied, modified, or distributed
9+
// except according to those terms.
10+
11+
enum Foo = u32;
12+
13+
const X: Foo = Foo(17);
14+
15+
fn main() {
16+
assert(*X == 17);
17+
assert(*Y == 23);
18+
}
19+
20+
const Y: Foo = Foo(23);

branches/try/src/test/run-pass/const-nullary-enum.rs

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
// Copyright 2012 The Rust Project Developers. See the COPYRIGHT
1+
// Copyright 2012-2013 The Rust Project Developers. See the COPYRIGHT
22
// file at the top-level directory of this distribution and at
33
// http://rust-lang.org/COPYRIGHT.
44
//
@@ -21,5 +21,10 @@ fn main() {
2121
Bar => {}
2222
Baz | Boo => fail
2323
}
24+
match Y {
25+
Baz => {}
26+
Bar | Boo => fail
27+
}
2428
}
2529

30+
const Y: Foo = Baz;

branches/try/src/test/run-pass/const-nullary-univariant-enum.rs

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -16,4 +16,7 @@ const X: Foo = Bar;
1616

1717
fn main() {
1818
assert((X as uint) == 0xDEADBEE);
19+
assert((Y as uint) == 0xDEADBEE);
1920
}
21+
22+
const Y: Foo = Bar;

0 commit comments

Comments
 (0)