Skip to content

rustdoc: module flag to prevent code blocks without a lang item from counting as rust #59867

Open
@Lokathor

Description

@Lokathor

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.

Metadata

Metadata

Assignees

No one assigned

    Labels

    C-feature-requestCategory: A feature request, i.e: not implemented / a PR.T-rustdocRelevant to the rustdoc team, which will review and decide on the PR/issue.

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions