Skip to content

How to turn off cargo doc test and compile for a specific package in Rust #9146

@liufuyang

Description

@liufuyang

Describe the problem you are trying to solve

I have some generated rs code (from grpc proto filles) and they are checked in with my normal rust code under src but in some sub modules. The issue is when doing cargo test the doc test will run and some of the generated rs have comments with some indentations and cargo doc test trying to compile them and failed.

For example cargo test will try to compile (and perhaps run these lines) show here.

The cargo output could be like:

---- src/google/google.bigtable.v2.rs - google::bigtable::v2::row_filter::Interleave::filters (line 268) stdout ----
error: expected one of `!`, `.`, `::`, `;`, `?`, `{`, `}`, or an operator, found `row`
 --> src/google/google.bigtable.v2.rs:269:7
  |
3 | input row
  |       ^^^ expected one of 8 possible tokens

error: aborting due to previous error

Couldn't compile the test.

I seem cannot find a way to exclude or ignore those generated rs for doc test (without manually changing them)?

Describe the solution you'd like

Perhaps allow some type of configuration in Cargo.toml or some ignore file like .cargo_test_ignore to specify some path or packages to ignore cargo doing doc test on those?


PS: I asked the same on stackoverlow

Metadata

Metadata

Assignees

No one assigned

    Labels

    C-feature-requestCategory: proposal for a feature. Before PR, ping rust-lang/cargo if this is not `Feature accepted`

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions