Skip to content

Commit ea8cd66

Browse files
committed
---
yaml --- r: 6900 b: refs/heads/master c: 1e4de33 h: refs/heads/master v: v3
1 parent 1770a97 commit ea8cd66

File tree

2 files changed

+6
-4
lines changed

2 files changed

+6
-4
lines changed

[refs]

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,2 +1,2 @@
11
---
2-
refs/heads/master: 085c813fe3f03c67aa8e8cb7fa005886d9447c50
2+
refs/heads/master: 1e4de333740690357a8f58883c5c69bf58be1424

trunk/src/comp/syntax/codemap.rs

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -35,15 +35,17 @@ type lookup_fn = fn(file_pos) -> uint;
3535

3636
fn lookup_pos(map: codemap, pos: uint, lookup: lookup_fn) -> loc {
3737
let len = vec::len(map.files);
38+
if len > 1u && map.files[len - 1u].name == "-" {
39+
// the trailing "-" must be the core_macros inserted by expand_crate,
40+
// exclude it from the targets to lookup
41+
len = len - 1u;
42+
}
3843
let a = 0u;
3944
let b = len;
4045
while b - a > 1u {
4146
let m = (a + b) / 2u;
4247
if lookup(map.files[m].start_pos) > pos { b = m; } else { a = m; }
4348
}
44-
if (a >= len) {
45-
ret { filename: "-", line: 0u, col: 0u };
46-
}
4749
let f = map.files[a];
4850
a = 0u;
4951
b = vec::len(f.lines);

0 commit comments

Comments
 (0)