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 1e4de33374
.
This commit is contained in:
parent
93e9600a94
commit
1625a4320d
1 changed files with 3 additions and 5 deletions
|
@ -34,17 +34,15 @@ type lookup_fn = fn@(file_pos) -> uint;
|
||||||
|
|
||||||
fn lookup_pos(map: codemap, pos: uint, lookup: lookup_fn) -> loc {
|
fn lookup_pos(map: codemap, pos: uint, lookup: lookup_fn) -> loc {
|
||||||
let len = vec::len(map.files);
|
let len = vec::len(map.files);
|
||||||
if len > 1u && map.files[len - 1u].name == "-" {
|
|
||||||
// the trailing "-" must be the core_macros inserted by expand_crate,
|
|
||||||
// exclude it from the targets to lookup
|
|
||||||
len = len - 1u;
|
|
||||||
}
|
|
||||||
let a = 0u;
|
let a = 0u;
|
||||||
let b = len;
|
let b = len;
|
||||||
while b - a > 1u {
|
while b - a > 1u {
|
||||||
let m = (a + b) / 2u;
|
let m = (a + b) / 2u;
|
||||||
if lookup(map.files[m].start_pos) > pos { b = m; } else { a = m; }
|
if lookup(map.files[m].start_pos) > pos { b = m; } else { a = m; }
|
||||||
}
|
}
|
||||||
|
if (a >= len) {
|
||||||
|
ret { filename: "-", line: 0u, col: 0u };
|
||||||
|
}
|
||||||
let f = map.files[a];
|
let f = map.files[a];
|
||||||
a = 0u;
|
a = 0u;
|
||||||
b = vec::len(f.lines);
|
b = vec::len(f.lines);
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue