Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

cargo test --all-targets does not run doc tests #6669

Open
thomaseizinger opened this issue Feb 15, 2019 · 18 comments
Open

cargo test --all-targets does not run doc tests #6669

thomaseizinger opened this issue Feb 15, 2019 · 18 comments
Labels
A-doctests Area: rustdoc --test Command-test E-medium Experience: Medium S-needs-design Status: Needs someone to work further on the design for the feature or fix. NOT YET accepted.

Comments

@thomaseizinger
Copy link

As per title cargo test --all-targets does not run the doc tests on a crate. This is very surprising behaviour. I found this and it looks like running doc tests is done by rustdoc which is apparently not invoked when doing --all-targets.

@dwijnand
Copy link
Member

An attempt to fix this was made in #6671, but there's a bit of a mismatch between cargo test and doc tests that makes the issue complicated, so the PR didn't land.

@thomaseizinger
Copy link
Author

thomaseizinger commented Feb 18, 2019

Maybe it is worth to add some context to this issue.

We ran into this because we use cargo test --all-targets on Travis and usually cargo test locally.
A not-compiling doc test sneaked into a last-minute update of a PR but the build was fine since we use --all-targets on Travis.
Later on, someone complained that we have a broken master because of a non-compiling doc test.

I read some of the discussion in the #6671 and TBH, the whole --doc is a mode would be SUPER confusing.
As a user, I expect cargo test to test LESS than cargo test --all-targets since the latter has all in the name.
In addition, the documentation (--help) lists doc tests next to all the other targets.

@glts
Copy link

glts commented Nov 18, 2019

This means the command to run absolutely all tests everywhere is cargo test --workspace, not cargo test --workspace --all-targets, right?

@ehuss
Copy link
Contributor

ehuss commented Nov 18, 2019

This means the command to run absolutely all tests everywhere is cargo test --workspace, not cargo test --workspace --all-targets, right?

It depends on the structure of your packages, but in general there is currently no single command to "test everything". cargo test is intended to be the usual command. If you also want to test benchmarks and examples, you can either mark them with test=true in Cargo.toml, or run two commands (cargo test --all-targets and cargo test --doc).

BusyJay added a commit to tikv/tikv that referenced this issue Mar 6, 2020
Tests has been built slowly lately. That's because we use multiple compile
command to build tests for different crates. Things go worse when cdc is
split as a component. On my local machine, running `make test`, cargo
will be invoked 6 times. 4 of them takes minutes to finish.

The reason why we try to run multiple compile command is to get around
the problem mentioned in #6097, which is introduced when trying to
support prost and protobuf in tests at the same time. But in practice, we
don't run tests with prost. Hence overhead is introduced with just potential
benefit. In fact, after #6317, it's impossible to run tests by
`PROST=1 make test` due to rust-lang/cargo#6669.  It's still possible to
build, clippy check or release with prost.

Given that tests with PROST=1 does not work, this PR combines all the cargo
commands into single one, which save a lot of compile time.

Signed-off-by: Jay Lee <BusyJayLee@gmail.com>
zhangjinpeng87 pushed a commit to zhangjinpeng87/tikv that referenced this issue Mar 26, 2020
Tests has been built slowly lately. That's because we use multiple compile
command to build tests for different crates. Things go worse when cdc is
split as a component. On my local machine, running `make test`, cargo
will be invoked 6 times. 4 of them takes minutes to finish.

The reason why we try to run multiple compile command is to get around
the problem mentioned in tikv#6097, which is introduced when trying to
support prost and protobuf in tests at the same time. But in practice, we
don't run tests with prost. Hence overhead is introduced with just potential
benefit. In fact, after tikv#6317, it's impossible to run tests by
`PROST=1 make test` due to rust-lang/cargo#6669.  It's still possible to
build, clippy check or release with prost.

Given that tests with PROST=1 does not work, this PR combines all the cargo
commands into single one, which save a lot of compile time.

Signed-off-by: Jay Lee <BusyJayLee@gmail.com>
c1ay pushed a commit to c1ay/tikv that referenced this issue May 9, 2020
Tests has been built slowly lately. That's because we use multiple compile
command to build tests for different crates. Things go worse when cdc is
split as a component. On my local machine, running `make test`, cargo
will be invoked 6 times. 4 of them takes minutes to finish.

The reason why we try to run multiple compile command is to get around
the problem mentioned in tikv#6097, which is introduced when trying to
support prost and protobuf in tests at the same time. But in practice, we
don't run tests with prost. Hence overhead is introduced with just potential
benefit. In fact, after tikv#6317, it's impossible to run tests by
`PROST=1 make test` due to rust-lang/cargo#6669.  It's still possible to
build, clippy check or release with prost.

Given that tests with PROST=1 does not work, this PR combines all the cargo
commands into single one, which save a lot of compile time.

Signed-off-by: Jay Lee <BusyJayLee@gmail.com>
mlafeldt added a commit to mlafeldt/codebreaker-rs that referenced this issue May 15, 2020
anp added a commit to anp/moxie that referenced this issue Jul 2, 2020
anp added a commit to anp/moxie that referenced this issue Jul 3, 2020
pbougue pushed a commit to pbougue/transit_model that referenced this issue Jul 10, 2020
Running doctests and all-targets
(see rust-lang/cargo#6669)

Also bump version
pbougue pushed a commit to pbougue/transit_model that referenced this issue Jul 10, 2020
Running doctests and all-targets
(see rust-lang/cargo#6669)
jonasbb added a commit to jonasbb/serde_with that referenced this issue Jan 30, 2021
The `--all-targets` flag for `cargo test` actually DISABLES doctests.
Doctests should of course be run, so removing the flag from the CI scrips.
There is a bug report for cargo about this behavior:
rust-lang/cargo#6669

This fixes the changes done in #235 / 9a6c3bf.
Veetaha added a commit to Veetaha/marker that referenced this issue Oct 22, 2023
Turns out a simple `cargo test` doesn't run doctests for binaries. It does run them for libraries though.

The solution is to separate the test command into two `cargo test --all-targets` (which, unintuitively, doesn't invoke doc tests rust-lang/cargo#6669), and then run `cargo test --doc`
github-merge-queue bot pushed a commit to rust-marker/marker that referenced this issue Oct 23, 2023
Turns out a simple `cargo test` doesn't run doctests for binaries. It does run them for libraries though.

The solution is to separate the test command into two `cargo test --all-targets` (which, unintuitively, doesn't invoke doc tests rust-lang/cargo#6669), and then run `cargo test --doc`
Sky9x added a commit to Sky9x/mstr that referenced this issue Nov 23, 2023
Sky9x added a commit to inertya/nr-spec-md that referenced this issue Nov 23, 2023
@weihanglo
Copy link
Member

I'd like to copy over some proposals from ehuss that was buried in a closed PR. Fundamentally this is more a UX issue than performance or technical issue.


Method A: --doc is a mode flag.

  • --doc will doctest all doctestable targets.
  • --doc <target flags> will only doctest the given targets.
  • --doc --all-targets would only doctest all targets.
  • --all-targets would only rustc test all targets. (Or, maybe it could do both tests and doctests?)
  • <target flags> will only rustc test the given targets.

Drawbacks here: I'm not sure if this is clear. If --all-targets only does rustc tests, then you would need two commands (cargo test --all-targets and cargo test --doc --all-targets) to do everything. If it does both, then it is a special case that people need to learn about. You wouldn't be able to say "test and doctest all examples", unless all plurality flags like --examples are special, in which case I think it would be confusing if --example foo didn't run doctests (but that seems undesirable to me).

Method B: --mode=... can specify the types of tests that are run.

  • --mode=test,doctest <target flags> will test and doctest the given targets.
  • No --mode means rustc test only.

Drawbacks is that this adds another flag, which is very undesirable.

Method C: --doc could take targets as a parameter

  • --doc --lib doctests all doctestable targets, and rustc tests just the library.
  • --doc=lib doctests just the lib.
  • --doc=lib,example=foo,bins doctests lib, example foo, and all bins.
  • --doc=all-targets --all-targets does everything

Drawbacks is that I think the first case is confusing, and the last one is awkward.


@weihanglo weihanglo added S-needs-design Status: Needs someone to work further on the design for the feature or fix. NOT YET accepted. A-doctests Area: rustdoc --test E-medium Experience: Medium labels Dec 11, 2023
@est31
Copy link
Member

est31 commented Dec 11, 2023

Yeah it would be great if there was a single command to run all tests, doctests, everything.

having a unified command is a blocker for re-attempting #8437

0x61nas pushed a commit to 0x61nas/lqth that referenced this issue Dec 12, 2023
`cargo test --all-features` does not run doc-tests. For more information
see rust-lang/cargo#6669.
0x61nas added a commit to 0x61nas/lqth that referenced this issue Dec 12, 2023
* Add one codecov

* Merge another codecov

* Merge another codecov

* Merge another codecov

* Merge another codecov

* Place codecov config under .github

* Add (only) ASAN workflow

* Add first coverage workflow

* Merge another coverage.yml

* Merge another coverage.yml

* Add first features workflow

* Merge another features workflow

* Merge another features workflow

* Merge another features workflow

* Add (only) loom workflow

* Add (only) LSAN workflow

* Add first minial workflow

* Add (only) miri workflow

* Add first msrv workflow

* Merge another msrv workflow

* Merge another msrv workflow

* Merge another msrv workflow

* Add (only) no-std workflow

* Add first os-check workflow

* Merge another os-check workflow

* Add first style workflow

* Merge another style workflow

* Merge another style workflow

* Add first test workflow

* Merge another test workflow

* Merge another test workflow

* Merge another test workflow

* Make everything use checkout@v3

* Standardize on 'main' as branch name

* Missed a submodule checkout

* Add TODOs from twitter thread

* Practice what you preach

* mv github .github

This should make it possible to have rust-ci-conf as a remote you merge
from.

* Merge safety workflows

* Catch upcoming deprecations

* More concise name for scheduled jobs

* Allow examples and binaries to require features

* Use dependabot, but only for major versions

* ignore is a list

* Notify if actions themselves are outdated

* Bump codecov/codecov-action from 2 to 3

Bumps [codecov/codecov-action](https://github.com/codecov/codecov-action) from 2 to 3.
- [Release notes](https://github.com/codecov/codecov-action/releases)
- [Changelog](https://github.com/codecov/codecov-action/blob/main/CHANGELOG.md)
- [Commits](codecov/codecov-action@v2...v3)

---
updated-dependencies:
- dependency-name: codecov/codecov-action
  dependency-type: direct:production
  update-type: version-update:semver-major
...

Signed-off-by: dependabot[bot] <support@github.com>

* Move to maintained rust installer

See actions-rs/toolchain#216

* Fix install message for msrv

* Get rid of most actions-rs bits

Given that that project is unmaintained.

actions-rs/toolchain#216

* Minimal token permissions

See tokio-rs/tokio#5072

* Remove -Zmiri-tag-raw-pointers as it's now default

* Unbreak cargo hack for non-libraries (#4)

* Add action to run doctest. (#3)

`cargo test --all-features` does not run doc-tests. For more information
see rust-lang/cargo#6669.

* chore: automatically cancel superseded Actions runs (#5)

* [sanity] More robust injection of opt-level 1 (#9)

Fixes #8

* Quote MSRV version to avoid float parsing (#11)

Put 1.70 in there (for instance if you want to pin against OnceLock stabilizing) and it will actually test 1.7 as it appears github auto converts this to a float?

Putting in quotes seems to do the right thing here

* Install Openssl for Windows (#12)

* Don't install OpenSSL on Windows by default

* Bump actions/checkout from 3 to 4 (#13)

Bumps [actions/checkout](https://github.com/actions/checkout) from 3 to 4.
- [Release notes](https://github.com/actions/checkout/releases)
- [Changelog](https://github.com/actions/checkout/blob/main/CHANGELOG.md)
- [Commits](actions/checkout@v3...v4)

---
updated-dependencies:
- dependency-name: actions/checkout
  dependency-type: direct:production
  update-type: version-update:semver-major
...

Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>

* docs: Add documentation based on the youtube video (#10)

* Nit: Selecting direct minimal versions flag is -Zdirect-minimal-versions (#16)

* Add one codecov

* Merge another codecov

* Merge another codecov

* Merge another codecov

* Merge another codecov

* Place codecov config under .github

* Add (only) ASAN workflow

* Add first coverage workflow

* Merge another coverage.yml

* Merge another coverage.yml

* Add first features workflow

* Merge another features workflow

* Merge another features workflow

* Merge another features workflow

* Add (only) loom workflow

* Add (only) LSAN workflow

* Add first minial workflow

* Add (only) miri workflow

* Add first msrv workflow

* Merge another msrv workflow

* Merge another msrv workflow

* Merge another msrv workflow

* Add (only) no-std workflow

* Add first os-check workflow

* Merge another os-check workflow

* Add first style workflow

* Merge another style workflow

* Merge another style workflow

* Add first test workflow

* Merge another test workflow

* Merge another test workflow

* Merge another test workflow

* Make everything use checkout@v3

* Standardize on 'main' as branch name

* Missed a submodule checkout

* Add TODOs from twitter thread

* Practice what you preach

* mv github .github

This should make it possible to have rust-ci-conf as a remote you merge
from.

* Merge safety workflows

* Catch upcoming deprecations

* More concise name for scheduled jobs

* Allow examples and binaries to require features

* Use dependabot, but only for major versions

* ignore is a list

* Notify if actions themselves are outdated

* Bump codecov/codecov-action from 2 to 3

Bumps [codecov/codecov-action](https://github.com/codecov/codecov-action) from 2 to 3.
- [Release notes](https://github.com/codecov/codecov-action/releases)
- [Changelog](https://github.com/codecov/codecov-action/blob/main/CHANGELOG.md)
- [Commits](codecov/codecov-action@v2...v3)

---
updated-dependencies:
- dependency-name: codecov/codecov-action
  dependency-type: direct:production
  update-type: version-update:semver-major
...

Signed-off-by: dependabot[bot] <support@github.com>

* Move to maintained rust installer

See actions-rs/toolchain#216

* Fix install message for msrv

* Get rid of most actions-rs bits

Given that that project is unmaintained.

actions-rs/toolchain#216

* Minimal token permissions

See tokio-rs/tokio#5072

* Remove -Zmiri-tag-raw-pointers as it's now default

* Unbreak cargo hack for non-libraries (#4)

* Add action to run doctest. (#3)

`cargo test --all-features` does not run doc-tests. For more information
see rust-lang/cargo#6669.

* chore: automatically cancel superseded Actions runs (#5)

* [sanity] More robust injection of opt-level 1 (#9)

Fixes #8

* Quote MSRV version to avoid float parsing (#11)

Put 1.70 in there (for instance if you want to pin against OnceLock stabilizing) and it will actually test 1.7 as it appears github auto converts this to a float?

Putting in quotes seems to do the right thing here

* Install Openssl for Windows (#12)

* Don't install OpenSSL on Windows by default

* Bump actions/checkout from 3 to 4 (#13)

Bumps [actions/checkout](https://github.com/actions/checkout) from 3 to 4.
- [Release notes](https://github.com/actions/checkout/releases)
- [Changelog](https://github.com/actions/checkout/blob/main/CHANGELOG.md)
- [Commits](actions/checkout@v3...v4)

---
updated-dependencies:
- dependency-name: actions/checkout
  dependency-type: direct:production
  update-type: version-update:semver-major
...

Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>

* docs: Add documentation based on the youtube video (#10)

* Nit: Selecting direct minimal versions flag is -Zdirect-minimal-versions (#16)

* chore(github): create the code owners file

* chore(github): add the funding methods

* chore(github): create the issue templates

* chore(github): create the PR template

* chore(mergify): create `mergify` config

* chore(github): remove the `nostd` workflow

* chore(github): remove the `os-check` step and updated the branch name

* chore(github): create the CI workflow

* chore(github): update the branch name

* fix(workflow): disable the loom step for now

* fix(minimal-versions): set the minimal versoin of `thiserror` at 1.0.2

* fix(workflow): update the minimal rust version

* chore(codespell): create the codespell ignore file

* fix(workflow): don't try to build on windows or macos

* docs: fix typos

* chore(codespell): ignore `crate`

* fix(workflow): install X11

* fix(workflow): fix typos

* chore(mergify): disable the Dbpndabot rule

* chore(github): remove the CI workflow

* chore(github): add lint step to the test workflow

---------

Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: Jon Gjengset <jon@thesquareplanet.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
Co-authored-by: Tudyx <56633664+Tudyx@users.noreply.github.com>
Co-authored-by: Burkhard Mittelbach <wasabi37a@googlemail.com>
Co-authored-by: Simen Bekkhus <sbekkhus91@gmail.com>
Co-authored-by: James Chacon <chacon.james@gmail.com>
Co-authored-by: Rod Elias <rodiney@gmail.com>
Co-authored-by: Josh McKinney <joshka@users.noreply.github.com>
Co-authored-by: Mathias Pius <g+github@pius.io>
@thomaseizinger
Copy link
Author

thomaseizinger commented Dec 21, 2023

Just for some clarification, cargo has a model where there is a distinction between a target and a mode. Doctests are a mode, and that is why --all-targets by itself doesn't run them. I understand that can be confusing, isn't obvious from the documentation, and not the mental model some people have. We have talked in the past about making that more explicit (which in part would solve this issue by offering new switches to do both "run tests" and "run doctests"). I can't find that discussion offhand, but I don't think it was very deep anyway (just acknowledging that the CLI is limited and there were some ideas around a --mode flag). Perhaps that's something the testing team could tackle 😉 .

I don't know anything about the internals of cargo and I've been using Rust for close to 6 years now in a full-time setting. This is the first time I am hearing about cargo having a mode (other than the "release mode" toggled by --release).

Can we just remove the --doc flag and always include doc tests in every target that is selected, i.e. --lib, --tests, --examples etc. The usecase of only running doc tests could be served by a new flag of cargo doc: cargo doc --tests although I'd probably play it conservative and not add that one to begin with. It seems odd wanting to run only the doc tests. If doc tests are just more tests that get compiled into the crate, they could be selected via the regular filtering of test names. Perhaps they should all be under a dedicated doc module? Something like cargo test mycrate::doc::my_function_name_that_has_doc_test.

@est31
Copy link
Member

est31 commented Dec 22, 2023

Can we just remove the --doc flag and always include doc tests in every target that is selected

doctests are not unit tests, they are integration tests. In other words, they require a separate rustc process to be spawned for each snippet. On top of that, you have the rustdoc process (which isn't that neccessary, one could move the logic to extract the snippets to a place shared by rustc and rustdoc).

edit: there is the third issue, one that all integration tests face, that they can depend on the crate as an external dependency. In other words you need to compile the lib crate with #[cfg(test)] disabled.

0x61nas pushed a commit to 0x61nas/aarty that referenced this issue Jan 29, 2024
`cargo test --all-features` does not run doc-tests. For more information
see rust-lang/cargo#6669.
wfxr pushed a commit to wfxr/rlt that referenced this issue Mar 26, 2024
Merge another codecov

Merge another codecov

Merge another codecov

Merge another codecov

Place codecov config under .github

Add (only) ASAN workflow

Add first coverage workflow

Merge another coverage.yml

Merge another coverage.yml

Add first features workflow

Merge another features workflow

Merge another features workflow

Merge another features workflow

Add (only) loom workflow

Add (only) LSAN workflow

Add first minial workflow

Add (only) miri workflow

Add first msrv workflow

Merge another msrv workflow

Merge another msrv workflow

Merge another msrv workflow

Add (only) no-std workflow

Add first os-check workflow

Merge another os-check workflow

Add first style workflow

Merge another style workflow

Merge another style workflow

Add first test workflow

Merge another test workflow

Merge another test workflow

Merge another test workflow

Make everything use checkout@v3

Standardize on 'main' as branch name

Missed a submodule checkout

Add TODOs from twitter thread

Practice what you preach

mv github .github

This should make it possible to have rust-ci-conf as a remote you merge
from.

Merge safety workflows

Catch upcoming deprecations

More concise name for scheduled jobs

Allow examples and binaries to require features

Use dependabot, but only for major versions

ignore is a list

Notify if actions themselves are outdated

Bump codecov/codecov-action from 2 to 3

Bumps [codecov/codecov-action](https://github.com/codecov/codecov-action) from 2 to 3.
- [Release notes](https://github.com/codecov/codecov-action/releases)
- [Changelog](https://github.com/codecov/codecov-action/blob/main/CHANGELOG.md)
- [Commits](codecov/codecov-action@v2...v3)

---
updated-dependencies:
- dependency-name: codecov/codecov-action
  dependency-type: direct:production
  update-type: version-update:semver-major
...

Signed-off-by: dependabot[bot] <support@github.com>

Move to maintained rust installer

See actions-rs/toolchain#216

Fix install message for msrv

Get rid of most actions-rs bits

Given that that project is unmaintained.

actions-rs/toolchain#216

Minimal token permissions

See tokio-rs/tokio#5072

Remove -Zmiri-tag-raw-pointers as it's now default

Unbreak cargo hack for non-libraries (#4)

Add action to run doctest. (#3)

`cargo test --all-features` does not run doc-tests. For more information
see rust-lang/cargo#6669.

chore: automatically cancel superseded Actions runs (#5)

[sanity] More robust injection of opt-level 1 (#9)

Fixes #8

Quote MSRV version to avoid float parsing (#11)

Put 1.70 in there (for instance if you want to pin against OnceLock stabilizing) and it will actually test 1.7 as it appears github auto converts this to a float?

Putting in quotes seems to do the right thing here

Install Openssl for Windows (#12)

Don't install OpenSSL on Windows by default

Bump actions/checkout from 3 to 4 (#13)

Bumps [actions/checkout](https://github.com/actions/checkout) from 3 to 4.
- [Release notes](https://github.com/actions/checkout/releases)
- [Changelog](https://github.com/actions/checkout/blob/main/CHANGELOG.md)
- [Commits](actions/checkout@v3...v4)

---
updated-dependencies:
- dependency-name: actions/checkout
  dependency-type: direct:production
  update-type: version-update:semver-major
...

Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>

docs: Add documentation based on the youtube video (#10)

Nit: Selecting direct minimal versions flag is -Zdirect-minimal-versions (#16)

chore: fix typos (#17)

Remove stray trailing whitespace

replace actions-rs/clippy-check with giraffate/clippy-action (#19)

Co-authored-by: rtkay123 <dev@kanjala.com>

Semi-breaking: update codecov action

Note: this requires adding `CODECOV_TOKEN` to your GitHub repository's
secrets! See associated comment in the commit content.

Uniform capitalization
dougEfresh pushed a commit to dougEfresh/fireblocks-sdk-rs that referenced this issue Apr 26, 2024
`cargo test --all-features` does not run doc-tests. For more information
see rust-lang/cargo#6669.
robamler added a commit to bamler-lab/constriction that referenced this issue Aug 31, 2024
I accidentally removed execution of doc tests on CI when I added the
`--all-targets` switch to `cargo test` in order to run benchmarks as
tests. It turns out that `cargo test --all-targets` doesn't run doc
tests (see rust-lang/cargo#6669 ).

The solution for running both doc tests and benchmarks as tests seems to
be to leave out the `--all-target` switch and instead mark benchmarks
with `test=true` in `Cargo.toml` (see
rust-lang/cargo#6669 (comment) ).
@joshtriplett
Copy link
Member

In today's @rust-lang/cargo meeting, we agreed to try the experiment of adding an --all-targets-including-doc unstable option, initially to cargo test and then to other commands like cargo build and cargo check. We don't yet know what we should call it, but we can experiment with implementation of it.

@Veetaha
Copy link

Veetaha commented Sep 3, 2024

Ah, I know that feel. I had the same problem at work with a similar option of all that we couldn't scale to include more options.

A naming suggestion (we used a similar one as well): --all-targets-and-doc

@epage
Copy link
Contributor

epage commented Sep 3, 2024

Also, when we do build, check, and fix (and suggest for clippy to do similar), we might want to add --doc flags to them (#6424).

As for naming, one idea is to explore disambiguating the term "target" in cargo. If we rename "build target", then the --all-<something> could just have the new meaning.

We lean towards a new flag because people likely have broken doctests (as evidenced by this thread). While they would want to discover and fix them, they likely want to do it on their own timetable and not be forced to by cargo.

@joshtriplett
Copy link
Member

Note that in a future edition we could potentially make --all-targets default to this, which would make this an interim option for current editions.

bestsoftwaretopappreviews25 added a commit to bestsoftwaretopappreviews25/arccstr that referenced this issue Sep 11, 2024
`cargo test --all-features` does not run doc-tests. For more information
see rust-lang/cargo#6669.
ariel-miculas added a commit to ariel-miculas/ocidir-rs that referenced this issue Sep 15, 2024
`cargo test --all-features` does not run doc-tests. See
rust-lang/cargo#6669

Signed-off-by: Ariel Miculas-Trif <amiculas@cisco.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
A-doctests Area: rustdoc --test Command-test E-medium Experience: Medium S-needs-design Status: Needs someone to work further on the design for the feature or fix. NOT YET accepted.
Projects
Status: No status
Development

No branches or pull requests

10 participants