Closed
Description
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.