Skip to content

[Feat]: Make cargo test --doc work with the lint crates to doc test examples #303

Description

@Veetaha

Summary

Today if you run cargo test --doc you'll see the following error

warning: doc tests are not supported for crate type(s) `cdylib` in package `marker_lints`
error: no library targets found in package `marker_lints`

There are no good solutions to this problem. Same problem is also described in use-ink/cargo-contract#494.

We could recommend setting crate-type = ["cdylib", "rlib"] to make the doc tests work, but it means that the lint crates would be compiled as a static library in addition to a dynamic one. I suppose that it will influence the lint crates compilation performance by compiling an additional unnecessary library target.

We could provide a command in cargo-marker that adds the rlib crate type temporarily for doc tests. But that will look ugly if we need to modify the Cargo.toml of the crate. What if the process is killed? The modifications to the Cargo.toml file will persist and be potentially committed to the version control. Copying the project to a temp directory would solve this, but it may have a bunch of edge cases on its own as well...

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    A-marker-cargoArea: All things connected to `cargo_marker`C-enhancementCategory: New feature or request

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions