Skip to content

Commit 65833e1

Browse files
committed
---
yaml --- r: 11263 b: refs/heads/master c: 94d4dcd h: refs/heads/master i: 11261: c1fba36 11259: 94a31e1 11255: 24a28aa 11247: 0cad0c6 11231: da3b12a 11199: b8e9f37 11135: 009b220 11007: c6f4faf 10751: 6e28a23 10239: 4ad2d85 v: v3
1 parent 0c31f7c commit 65833e1

File tree

3 files changed

+23
-3
lines changed

3 files changed

+23
-3
lines changed

[refs]

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
---
2-
refs/heads/master: 520c3f5f798f65b7b26fe9c7f6409ef2f3cf6984
2+
refs/heads/master: 94d4dcdbf0121a2b885b2cc45a1b387baf0c7b26
33
refs/heads/snap-stage1: e33de59e47c5076a89eadeb38f4934f58a3618a6
44
refs/heads/snap-stage3: 4a81779abd786ff22d71434c6d9a5917ea4cdfff
55
refs/heads/try: 2898dcc5d97da9427ac367542382b6239d9c0bbf

trunk/src/comp/middle/last_use.rs

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -137,7 +137,6 @@ fn visit_expr(ex: @expr, cx: ctx, v: visit::vt<ctx>) {
137137
// n.b.: safe to ignore copies, as if they are unused
138138
// then they are ignored, otherwise they will show up
139139
// as freevars in the body.
140-
141140
vec::iter(cap_clause.moves) {|ci|
142141
clear_def_if_path(cx, cx.def_map.get(ci.id), true);
143142
}
@@ -203,13 +202,18 @@ fn visit_fn(fk: visit::fn_kind, decl: fn_decl, body: blk,
203202
fn visit_block(tp: block_type, cx: ctx, visit: fn()) {
204203
let local = @{type: tp, mutable second: false, mutable exits: []};
205204
cx.blocks = cons(local, @cx.blocks);
205+
let start_current = cx.current;
206206
visit();
207207
local.second = true;
208+
local.exits = [];
209+
cx.current = start_current;
208210
visit();
209211
let cx_blocks = cx.blocks;
210212
check is_not_empty(cx_blocks);
211213
cx.blocks = tail(cx_blocks);
212-
cx.current = join_branches(local.exits);
214+
let branches = if tp == func { local.exits + [cx.current] }
215+
else { local.exits };
216+
cx.current = join_branches(branches);
213217
}
214218

215219
fn add_block_exit(cx: ctx, tp: block_type) -> bool {
Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,16 @@
1+
// Issue #1818
2+
3+
fn loop<T>(s: str, f: fn(str) -> T) -> T {
4+
while false {
5+
let r = f(s);
6+
ret r;
7+
}
8+
fail;
9+
}
10+
11+
fn apply<T>(s: str, f: fn(str) -> T) -> T {
12+
fn g<T>(s: str, f: fn(str) -> T) -> T {f(s)}
13+
g(s) {|v| let r = f(v); r }
14+
}
15+
16+
fn main() {}

0 commit comments

Comments
 (0)