-
Notifications
You must be signed in to change notification settings - Fork 13.4k
Compiler must show real line in failed test #29253
New issue
Have a question about this project? # for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “#”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? # to your account
Comments
Could you provide some more information or some example code / steps to reproduce this? |
Any test, any syntax error or assert shows positition relative to test begin |
Are you talking about the tests that are run by |
I mean documentation test running through |
OK, so to elaborate, the issue here is that doc test failures don't include the name of the file that contains the doc test. This is a result of how rustdoc works, which is by passing the source code of the test, as extracted from the comment in the file, to rustc via stdin. We can probably add an unstable command-line argument to rustc that allows a file name to be specified in such scenarios and amend rustdoc to use it. |
Do something, please. |
I'm investigating implementing this now. |
This doesn't actually need a command-line option added to rustc, as rustdoc calls |
Please try to recognize that this is an open source project, and many people are working in their spare time. Specifically, as far as I know, @apasel422 is not paid to work on Rust. While we want Rust to be great for everyone, the reality is that there are thousands of open bugs, and so some of them will take time to address. |
@steveklabnik Do you want me to do that? Could you aim me to this? Should I examine cargo sources? |
@KalitaAlexey If you're interested in implementing this yourself (I don't know when I'll be able to complete it), the general idea would be augmenting |
Thanks @apasel422, I've implemented the filename part here, but it turns out that solving the issue with line numbers being relative to the start of the codeblock instead of to the start of the file is kind of infeasible to solve (which is AIUI the main request from @KalitaAlexey). The current |
Allow custom filenames for anonymous inputs This came out of #29253 but doesn't fix it. I thought it might be worth merging on its own nonetheless.
I think we can close it? Just reopen it if you feel something is missing. |
Currently if some test fails then compiler shows error with relative position
<anon>:21:5
. This is very uncomfortableThe text was updated successfully, but these errors were encountered: