diff options
| author | Kevin Atkinson <kevina@cs.utah.edu> | 2012-01-22 17:24:55 -0700 |
|---|---|---|
| committer | Brian Anderson <banderson@mozilla.com> | 2012-01-23 17:37:15 -0800 |
| commit | ad21d9c64a1b7b6fb996f37d697c5d4f43f13bae (patch) | |
| tree | 20c81c17a0ee2fd2624079984cf235d19722c763 /src/rustdoc/parse.rs | |
| parent | 355edf13e7d41ecdef750b166824422e76c4ef26 (diff) | |
| download | rust-ad21d9c64a1b7b6fb996f37d697c5d4f43f13bae.tar.gz rust-ad21d9c64a1b7b6fb996f37d697c5d4f43f13bae.zip | |
Don't reset the chpos/byte_pos to 0 in new_parser_from_source_str.
This correctly fixes issue #1362. chpos/byte_pos are now the offsets within a particular file, but rather the offsets within a virtual file with is formed by combing all of the modules within a crate. Thus, resetting them to 0 causes an overlap and hence, bogus source locations. Fix #1362 by moving chpos/byte_pos to parse_sess so that new_parser_from_source_str has access to them and hence can chose an initial value that is not already been used in the crate. Note that the trigger for bug 1361 was that syntax/ext/expand.rs calls parse_expr_from_source_str (which calls new_parser_from_source_str) using the same codemap as the current crate (and hence causing overlap with files in the crate as new_parser_from_source_str resets the chpos/byte_pos to 0).
Diffstat (limited to 'src/rustdoc/parse.rs')
| -rw-r--r-- | src/rustdoc/parse.rs | 4 |
1 files changed, 3 insertions, 1 deletions
diff --git a/src/rustdoc/parse.rs b/src/rustdoc/parse.rs index 0afc625378d..11eb469e641 100644 --- a/src/rustdoc/parse.rs +++ b/src/rustdoc/parse.rs @@ -12,7 +12,9 @@ fn new_parse_sess() -> parser::parse_sess { let sess = @{ cm: cm, mutable next_id: 1, - diagnostic: diagnostic::mk_handler(cm, none) + diagnostic: diagnostic::mk_handler(cm, none), + mutable chpos: 0u, + mutable byte_pos: 0u }; ret sess; } |
