Skip to content

Commit 1625a43

Browse files
kevinabrson
authored andcommitted
Revert "rustc: Exclude stdin from codemap files when lookup_pos".
Need a better fix, right now it is just causing even more confusion, for example in issue #1448 and #1387. This reverts commit 1e4de33.
1 parent 93e9600 commit 1625a43

File tree

1 file changed

+3
-5
lines changed

1 file changed

+3
-5
lines changed

src/comp/syntax/codemap.rs

+3-5
Original file line numberDiff line numberDiff line change
@@ -34,17 +34,15 @@ type lookup_fn = fn@(file_pos) -> uint;
3434

3535
fn lookup_pos(map: codemap, pos: uint, lookup: lookup_fn) -> loc {
3636
let len = vec::len(map.files);
37-
if len > 1u && map.files[len - 1u].name == "-" {
38-
// the trailing "-" must be the core_macros inserted by expand_crate,
39-
// exclude it from the targets to lookup
40-
len = len - 1u;
41-
}
4237
let a = 0u;
4338
let b = len;
4439
while b - a > 1u {
4540
let m = (a + b) / 2u;
4641
if lookup(map.files[m].start_pos) > pos { b = m; } else { a = m; }
4742
}
43+
if (a >= len) {
44+
ret { filename: "-", line: 0u, col: 0u };
45+
}
4846
let f = map.files[a];
4947
a = 0u;
5048
b = vec::len(f.lines);

0 commit comments

Comments
 (0)