-
Notifications
You must be signed in to change notification settings - Fork 13.3k
Bogus span identified with unmatched import #1362
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Comments
Fixed by 1e4de33. Closing. |
@brson: I don't get any error when compiling rustray.rc. I reverted the commit that fixed the issue (see 891798fb for why) and applied what I believe is the correct fix. I am 99% sure my fix (b257549) addressed your issue, can you please verify. |
@kevina: your commits look correct to me and I can confirm that on your branch the rustray errors indicate the correct location of the error, though I don't see exactly where new_parser_from_source_str comes into play with parsing rustray's math32.rs. |
@brson: The offsets in Anyway I will open a pull request soonish, it might be bundled with the fix for #1448 and #1387 which I am working on now. |
I understand the situation with the codemap offsets. I just don't see where new_parser_from_source_str is called during the parsing of that crate. |
Sorry left that detail out, see |
This correctly fixes issue rust-lang#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 rust-lang#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).
Although its not really needed. Without that fix, reported spans will likely be bogus if the error is within the first couple of lines (probable around 5) of that file. Thus, many of the compile-fail tests will fail due to incorrect location.
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).
Although its not really needed. Without that fix, reported spans will likely be bogus if the error is within the first couple of lines (probable around 5) of that file. Thus, many of the compile-fail tests will fail due to incorrect location.
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).
Although its not really needed. Without that fix, reported spans will likely be bogus if the error is within the first couple of lines (probable around 5) of that file. Thus, many of the compile-fail tests will fail due to incorrect location.
Compiling the rustray.rc crate here https://github.com/brson/rustray/tree/bogus-error results in this error:
The error is actually in math3d.rs. This is odd that it's calling the file '-' since that is the placeholder for stdin.
The text was updated successfully, but these errors were encountered: