diff options
| author | Niko Matsakis <niko@alum.mit.edu> | 2012-08-23 14:46:59 -0700 |
|---|---|---|
| committer | Niko Matsakis <niko@alum.mit.edu> | 2012-08-23 18:54:08 -0700 |
| commit | a08f3a7d4d937c2b26c8a29edabe7fb089d0b5f7 (patch) | |
| tree | 778e2d94eca68fd3e579b2ad8ac2725602afe340 /src/libsyntax/ext | |
| parent | 83e7c869bdfadf0ed8aca92e76fc5073b63402e2 (diff) | |
| download | rust-a08f3a7d4d937c2b26c8a29edabe7fb089d0b5f7.tar.gz rust-a08f3a7d4d937c2b26c8a29edabe7fb089d0b5f7.zip | |
More complete fix to #3162 (borrowck bug related to access to rec fields)
Diffstat (limited to 'src/libsyntax/ext')
| -rw-r--r-- | src/libsyntax/ext/simplext.rs | 9 |
1 files changed, 5 insertions, 4 deletions
diff --git a/src/libsyntax/ext/simplext.rs b/src/libsyntax/ext/simplext.rs index 7c37312a433..586a428c1d7 100644 --- a/src/libsyntax/ext/simplext.rs +++ b/src/libsyntax/ext/simplext.rs @@ -205,10 +205,10 @@ fn transcribe(cx: ext_ctxt, b: bindings, body: @expr) -> @expr { /* helper: descend into a matcher */ -fn follow(m: arb_depth<matchable>, idx_path: @mut ~[uint]) -> +pure fn follow(m: arb_depth<matchable>, idx_path: &[uint]) -> arb_depth<matchable> { let mut res: arb_depth<matchable> = m; - for vec::each(*idx_path) |idx| { + for vec::each(idx_path) |idx| { res = match res { leaf(_) => return res,/* end of the line */ seq(new_ms, _) => new_ms[idx] @@ -222,7 +222,7 @@ fn follow_for_trans(cx: ext_ctxt, mmaybe: option<arb_depth<matchable>>, match mmaybe { none => return none, some(m) => { - return match follow(m, idx_path) { + return match follow(m, *idx_path) { seq(_, sp) => { cx.span_fatal(sp, ~"syntax matched under ... but not " + @@ -274,7 +274,8 @@ fn transcribe_exprs(cx: ext_ctxt, b: bindings, idx_path: @mut ~[uint], /* we need to walk over all the free vars in lockstep, except for the leaves, which are just duplicated */ do free_vars(b, repeat_me) |fv| { - let cur_pos = follow(b.get(fv), idx_path); + let fv_depth = b.get(fv); + let cur_pos = follow(fv_depth, *idx_path); match cur_pos { leaf(_) => (), seq(ms, _) => { |
