cargo test
wants to execute English language prose from bindgen as a doc test
#7252
Labels
C-bug
Category: bug
Uh oh!
There was an error while loading. Please reload this page.
Problem
Cargo test tries to execute English language prose in the comments of the rust file generated by
bindgen
as doc tests, just because the header documentation of the original codehad some indented passages.
It seems very inconvenient that code would not compile because of something going on in the comments. Especially when what's in the comments is misintepreted by the toolchain.
Steps
src/lib.rs
andbindgen/lib.rs
.bindgen/lib.rs
is generated bybindgen
,lib.rs
is the hand-written part.src/lib.rs
contains an `include!("../bindgen/lib.rs") to keep hand-written and generated parts separate.cargo test
tries to interpret comments in../bindgen/lib.rs
as rust tests. They are just english prose that happens to be indented. Error is seen below.#![doc(tests(ignore))]
, but it's a top level directive. Which means if you do add it to both files, then the compiler will complain thatsrc/lib.rs
has this directive at a non-top-levelplace. If you add it just to one, the compiler will complain about the other file.
Possible Solution(s)
There could be a flag to forbid doc test execution for files that I don't want treated this way.
Notes
Output of
cargo version
:cargo 1.38.0-nightly (e853aa9 2019-08-09)
The text was updated successfully, but these errors were encountered: