rustdoc: module flag to prevent code blocks without a lang item from counting as rust · Issue #59867 · rust-lang/rust (original) (raw)
So, I've got some code being generated by bindgen
. The C source has doxygen
doc comments in it, which bindgen
faithfully converts over into doc comments. However, some of the doxygen
content is indented with spaces (numbered lists and the like), so when converted into rustdoc it becomes a code block. These code blocks are picked up as "doctests" by cargo test
, which then of course fail to build because they're not Rust code at all.
I'm told that, internally, this is all just code block elements by the time rustdoc sees it, you can't tell which code block was made via a backtick fence and which was made via indentation. However, you can tell if a lang was declared on the code block.
So what I need is an opt-in flag that you can declare module-wide (and children modules and such) so that any code block without a declared language is not treated as rust code by default, so then it won't become a doctest.