Skip to content

Commit e94aaeb

Browse files
kevinanikomatsakis
authored andcommitted
---
yaml --- r: 14810 b: refs/heads/try c: 1598527 h: refs/heads/master v: v3
1 parent ee2988f commit e94aaeb

File tree

3 files changed

+13
-2
lines changed

3 files changed

+13
-2
lines changed

[refs]

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,5 +2,5 @@
22
refs/heads/master: 61b1875c16de39c166b0f4d54bba19f9c6777d1a
33
refs/heads/snap-stage1: e33de59e47c5076a89eadeb38f4934f58a3618a6
44
refs/heads/snap-stage3: 4a81779abd786ff22d71434c6d9a5917ea4cdfff
5-
refs/heads/try: 6f5853f5a1767e0c418fd5f348a795b76d701b3e
5+
refs/heads/try: 15985277b98e53014b52c1e243eefcfb0335089f
66
refs/tags/release-0.1: 1f5c5126e96c79d22cb7862f75304136e204f105

branches/try/src/rustc/syntax/ext/qquote.rs

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -103,6 +103,9 @@ fn gather_anti_quotes<N: qq_helper>(lo: uint, node: N) -> aq_ctxt
103103
with *default_visitor()};
104104
let cx = @{lo:lo, mutable gather: []};
105105
node.visit(cx, mk_vt(v));
106+
// FIXME: Maybe this is an overkill (merge_sort), it might be better
107+
// to just keep the gather array in sorted order ...
108+
cx.gather = std::sort::merge_sort({|a,b| a.lo < b.lo}, copy cx.gather);
106109
ret cx;
107110
}
108111

@@ -200,9 +203,11 @@ fn finish<T: qq_helper>
200203
let qcx = gather_anti_quotes(sp.lo, node);
201204
let cx = qcx;
202205

203-
// assert that the vector is sorted by position:
204206
uint::range(1u, vec::len(cx.gather)) {|i|
205207
assert cx.gather[i-1u].lo < cx.gather[i].lo;
208+
// ^^ check that the vector is sorted
209+
assert cx.gather[i-1u].hi <= cx.gather[i].lo;
210+
// ^^ check that the spans are non-overlapping
206211
}
207212

208213
let str2 = "";

branches/try/src/test/run-pass/qquote.rs

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -91,6 +91,12 @@ fn main() {
9191

9292
let crate = #ast(crate) { fn a() { } };
9393
check_pp(crate, pprust::print_crate_, "fn a() { }\n");
94+
95+
// issue #1926
96+
let s = #ast(expr){__s};
97+
let e = #ast(expr){__e};
98+
let call = #ast(expr){$(s).foo {|__e| $(e)}};
99+
check_pp(call, pprust::print_expr, "__s.foo {|__e| __e }")
94100
}
95101

96102
fn check_pp<T>(expr: T, f: fn(pprust::ps, T), expect: str) {

0 commit comments

Comments
 (0)