-
Notifications
You must be signed in to change notification settings - Fork 12.9k
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
Ignored doctests are run with cargo test -- --ignored
.
#87586
Comments
This is also very similar to #82715. |
It also seems similar to #63193. |
I think My ideal state of the world:
Given current usage of
Unless maybe this can be cleaned up over an edition change? Footnotes
|
As of some point between example pwsh session
Now in order to run It looks like this may have been a bugfix cc @epage -- the only change in cargo's git history I saw in a quick skim that looked like it could've changed this behavior is the clap4 upgrade changing how |
To be clear, this change makes the nightly state
Personally I think this is a completely reasonable state and nothing needs to be added. |
I would say running ignored (doc)tests when
|
I wanted to leave a comment in support of the nightly change. My main use case of wanting this addressed is writing mixed markdown files (like README.md) where I want to include non-rust-code (CLI usage with output, for example) but also make sure that the example code I DO provide is tested via my doc tests (using the I need a way to tell rust "hey, seriously, honestly this really isn't something you should even consider running." For right now the only way to do that is via
For my use case of testing my READMEs this change would work well. I'm relatively new to the ecosystem. What's the path off of nightly and onto stable look like? |
In my experience, nearly 100% of the time Even if we decide that That said, if the status quo on nightly is to require
Thanks, this is useful, I hadn't thought of it. |
* fix: use array instead of Vec for Codon representation * don't allocate until necessary * reduce usage of lazy_static, use consts instead where possible, copy instead of reference lookup tables * cache calls to alignment::Mapper::new * rely on seqrepo-rs with cloneable Error * fmt * implement data_version and schema_version for mock Provider in tests * update seqrepo to v0.10.2 * shorter Arc::new error wrapping * clippy lints * clippy lints * do not run doctests for sequence.rs generators * workaround ignore in doctest by using stringify, see rust-lang/rust/issues/87586
If you use
rust,ignore
to ignore doctests which don't compile (often because you want to include example code that's entirely expository in your documentation — something that doesn't compile at all, and should merely syntax highlight as Rust), they still are attempted to compile and run when you pass--ignored
to the test runner.This is unfortunate, as this is what you use to run
#[ignore]
d tests, which are good (intended?) for tests that are too slow to complete in normal execution, often ones which are exhaustive. Having doctests that fail to compile be mixed in here means this use of#[ignore]
is effectively broken.The workaround I know for this is rather gross, e.g. using a
const _: &str = stringify!{ /* code that doesn't compile here */ }
wrapper (for example — even if usingignore
wouldn't have been an alternative here since it's large enough that you'd rather ensure it compiles in practice, this is the pattern I'm referring to).I think it's honestly a bug that this is the effect of
rust,ignore
, and think that instead it should be to just not emit the test.(This is related to, but distinct from #30032)
I bugged @jyn514 about this once and he indicated he thought it might require an RFC to fix, but when I was complaining about it elsewhere recently, someone pointed out that there was no bug on file for it already.
The text was updated successfully, but these errors were encountered: