Skip to content

Commit 145ca46

Browse files
committed
---
yaml --- r: 30335 b: refs/heads/incoming c: 9db4445 h: refs/heads/master i: 30333: c106fd6 30331: e439147 30327: 37d4aab 30319: 45a65de 30303: 9f51948 30271: 08aeb86 30207: a02edb7 v: v3
1 parent b83bbcb commit 145ca46

File tree

3 files changed

+56
-5
lines changed

3 files changed

+56
-5
lines changed

[refs]

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@ refs/heads/try: d324a424d8f84b1eb049b12cf34182bda91b0024
66
refs/tags/release-0.1: 1f5c5126e96c79d22cb7862f75304136e204f105
77
refs/heads/ndm: f3868061cd7988080c30d6d5bf352a5a5fe2460b
88
refs/heads/try2: d0c6ce338884ee21843f4b40bf6bf18d222ce5df
9-
refs/heads/incoming: fa2fb0f86831c7bdb1c874eb49074d11640d5cf9
9+
refs/heads/incoming: 9db44454541a9bcf1b1bed6cdda3c3213f355a25
1010
refs/heads/dist-snap: 2f32a1581f522e524009138b33b1c7049ced668d
1111
refs/tags/release-0.2: c870d2dffb391e14efb05aa27898f1f6333a9596
1212
refs/tags/release-0.3: b5f0d0f648d9a6153664837026ba1be43d3e2503

branches/incoming/src/rustc/middle/trans/alt.rs

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -58,8 +58,7 @@ fn trans_opt(bcx: block, o: opt) -> opt_result {
5858
return single_result(rslt(bcx, *cell));
5959
}
6060
_ => {
61-
return single_result(
62-
rslt(bcx, consts::const_expr(ccx, l)));
61+
return single_result(trans_temp_expr(bcx, l));
6362
}
6463
}
6564
}
@@ -636,13 +635,14 @@ fn compile_submatch(bcx: block, m: match_, vals: ~[ValueRef],
636635
}
637636
}
638637
lit(_) => {
639-
test_val = Load(bcx, val);
640638
let pty = node_id_type(bcx, pat_id);
639+
test_val = load_if_immediate(bcx, val, pty);
641640
kind = if ty::type_is_integral(pty) { switch }
642641
else { compare };
643642
}
644643
range(_, _) => {
645-
test_val = Load(bcx, val);
644+
let pty = node_id_type(bcx, pat_id);
645+
test_val = load_if_immediate(bcx, val, pty);
646646
kind = compare;
647647
}
648648
}
Lines changed: 51 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,51 @@
1+
// -*- rust -*-
2+
fn f1(ref_string: &str) {
3+
match ref_string {
4+
"a" => io::println("found a"),
5+
"b" => io::println("found b"),
6+
_ => io::println("not found")
7+
}
8+
}
9+
10+
fn f2(ref_string: &str) {
11+
match ref_string {
12+
"a" => io::println("found a"),
13+
"b" => io::println("found b"),
14+
s => io::println(fmt!("not found (%s)", s))
15+
}
16+
}
17+
18+
fn g1(ref_1: &str, ref_2: &str) {
19+
match (ref_1, ref_2) {
20+
("a", "b") => io::println("found a,b"),
21+
("b", "c") => io::println("found b,c"),
22+
_ => io::println("not found")
23+
}
24+
}
25+
26+
fn g2(ref_1: &str, ref_2: &str) {
27+
match (ref_1, ref_2) {
28+
("a", "b") => io::println("found a,b"),
29+
("b", "c") => io::println("found b,c"),
30+
(s1, s2) => io::println(fmt!("not found (%s, %s)", s1, s2))
31+
}
32+
}
33+
34+
fn main() {
35+
f1(@"a");
36+
f1(~"b");
37+
f1(&"c");
38+
f1("d");
39+
f2(@"a");
40+
f2(~"b");
41+
f2(&"c");
42+
f2("d");
43+
g1(@"a", @"b");
44+
g1(~"b", ~"c");
45+
g1(&"c", &"d");
46+
g1("d", "e");
47+
g2(@"a", @"b");
48+
g2(~"b", ~"c");
49+
g2(&"c", &"d");
50+
g2("d", "e");
51+
}

0 commit comments

Comments
 (0)