-
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
Tracking issue for cfg(doctest)
#62210
Comments
…laumeGomez rustdoc: set cfg(doctest) when collecting doctests Note: This PR builds on top of rust-lang#61199; only the last commit is specific to this PR. As discussed in rust-lang#61199, we want the ability to isolate items to only when rustdoc is collecting doctests, but we can't use `cfg(test)` because of libcore's `#![cfg(not(test))]`. This PR proposes a new cfg flag, `cfg(doctest)`, specific to this situation, rather than reusing an existing flag. I've isolated it behind a feature gate so that we can contain the effects to nightly only. (A stable workaround that can be used in lieu of `#[cfg(doctest)]` is `#[cfg(rustdoc)] #[doc(hidden)]`, at least once rust-lang#61351 lands.) Tracking issue: rust-lang#62210
Is there a decision whether this is considered misuse of To my knowledge, the revert happened so that we would have time to have that discussion. You can't discuss whether a change in behavior (of |
Also see @Mark-Simulacrum's statement at #63201 (comment):
|
... |
This feature allows you to restrict items to only be compiled when rustdoc is collecting doctests. This allows you to isolate certain doctests that will be tested, but not shown in documentation - for example, if you need to use
compile_fail
, or if you're testing the samples in your README file.We had previously set
cfg(test)
when collecting doctests, starting in #59940, but this caused issues with libcore that caused all its doctests to be ignored, so that was reverted in #61199. This feature is the replacement for that, currently unstable while we ensure the semantics. The PR where it was posted is #62213.The text was updated successfully, but these errors were encountered: