Incorrect span used for doctest when both an outer doc comment (///) and inner doc comment (//!) are used on a module #117753
Labels
A-diagnostics
Area: Messages for errors, warnings, and lints
A-doctests
Area: Documentation tests, run by rustdoc
T-compiler
Relevant to the compiler team, which will review and decide on the PR/issue.
T-rustdoc
Relevant to the rustdoc team, which will review and decide on the PR/issue.
Code
my_module.rs
lib.rs
cargo +nightly test --doc
Current output
Desired output
Rationale and extra context
the lines indicate lib.rs as the location where the failure happens which is not correct though I understand it may appear so to the compiler given it might be fusing the doc content at some point and not keep sub blocks original span (though it's confusing as I ended up in my lib.rs at a location that did not exist)
Basically adding a /// comment on top of the module on the lib.rs should not be modifying the span of the docstring coming from the module
In my case it indicated a non existent line in a rather small lib.rs
Other cases
No response
Anything else?
I tried various combinations of keywords to find related issues in the repo but could not find any (though some look similar they use an include macro which is not the case here #81070)
Thanks for the high quality of the tooling, those are edge cases which happen because well, if it can happen it will 😄
Cheers
The text was updated successfully, but these errors were encountered: