feature external_doc reports wrong test origins in doc tests #60996
Labels
C-bug
Category: This is a bug.
F-external_doc
`#![feature(external_doc)]`
T-rustdoc
Relevant to the rustdoc team, which will review and decide on the PR/issue.
Using
doc(include = .... )
allowscargo test --doc
to compile and test```
fenced sections in the markdown.However, the reported origins for these tests becomes completely confusing, as the line numbers appear to correlate to where you might expect to see the content, if the content was naively inlined.
However, literally none of the files mentioned have rustdoc code blocks in them, and 100% of these tests are from included files.
For example, reading category.rs at the expected offsets: ( with 2 lines either side for context )
test src/repository/category.rs - repository::category::Category (line 12) ... ok
test src/repository/category.rs - repository::category::Category (line 40) ... ok
test src/repository/category.rs - repository::category::Category (line 57) ... ok
test src/repository/category.rs - repository::category::Category (line 70) ... ok
test src/repository/category.rs - repository::category::CategoryFileIterator (line 106) ... ok
test src/repository/category.rs - repository::category::CategoryFileIterator (line 156) ... ok
( File only has 145 lines )
Whereas, if I take the include lines:
category.rs
12-15category.rs
77-80And do a little manual derviation to find source lines:
test src/repository/category.rs - repository::category::Category (line 12) ... ok
12 - 12 => 0
struct.Category.md
0-7test src/repository/category.rs - repository::category::Category (line 40) ... ok
40 - 12 => 28
struct.Category.md
28-37test src/repository/category.rs - repository::category::Category (line 57) ... ok
57 - 12 -> 45
struct.Category.md
45-56test src/repository/category.rs - repository::category::Category (line 70) ... ok
70 - 12 -> 58
struct.Category.md
58-73test src/repository/category.rs - repository::category::CategoryFileIterator (line 106) ... ok
106 - 77 -> 29
struct.CategoryFileIterator.md
29-46test src/repository/category.rs - repository::category::CategoryFileIterator (line 156) ... ok
156 - 77 -> 79
struct.CategoryFileIterator.md
79-89As you can see, manual re-calculation provides reasonable locations, which suggests part of the problem in display ( though my method seems to have off-by-one errors for some reason, shrug )
I believe this bug should block stabilization of this feature #44732
The text was updated successfully, but these errors were encountered: