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

rustdoc: set cfg(doctest) when collecting doctests #62213

Merged
merged 2 commits into from
Jul 7, 2019

Conversation

QuietMisdreavus
Copy link
Member

Note: This PR builds on top of #61199; only the last commit is specific to this PR.

As discussed in #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 #61351 lands.)

Tracking issue: #62210

@QuietMisdreavus QuietMisdreavus added the T-rustdoc Relevant to the rustdoc team, which will review and decide on the PR/issue. label Jun 28, 2019
@QuietMisdreavus
Copy link
Member Author

r? @rust-lang/rustdoc

@GuillaumeGomez
Copy link
Member

How long do we intend to keep this as a nightly only feature?

@bors
Copy link
Contributor

bors commented Jun 29, 2019

☔ The latest upstream changes (presumably #62226) made this pull request unmergeable. Please resolve the merge conflicts.

@bors bors added the S-waiting-on-author Status: This is awaiting some action (such as code changes or more information) from the author. label Jun 29, 2019
@QuietMisdreavus
Copy link
Member Author

It probably doesn't need to be unstable for long; users of doc-comment who can afford to include the feature flag can provide enough testing, if we're sure it won't interfere with libcore's doctests or the like again.

@QuietMisdreavus QuietMisdreavus added S-waiting-on-review Status: Awaiting review from the assignee but also interested parties. and removed S-waiting-on-author Status: This is awaiting some action (such as code changes or more information) from the author. labels Jul 2, 2019
@QuietMisdreavus
Copy link
Member Author

Updated. There was a CI error where the UI test i updated was flaky because the ordering was non-deterministic. I added --test-threads=1 to the command-line, so that should be fixed now.

@GuillaumeGomez
Copy link
Member

Once this is merged, I'll have to send "a few" PRs around. *sigh* Thanks for this anyway!

@bors
Copy link
Contributor

bors commented Jul 3, 2019

☔ The latest upstream changes (presumably #61775) made this pull request unmergeable. Please resolve the merge conflicts.

@QuietMisdreavus
Copy link
Member Author

Force-pushed to resolve merge conflict.

@GuillaumeGomez
Copy link
Member

Thanks!

@bors: r+

@bors
Copy link
Contributor

bors commented Jul 7, 2019

📌 Commit cff6ce6 has been approved by GuillaumeGomez

@bors bors added S-waiting-on-bors Status: Waiting on bors to run and complete tests. Bors will change the label on completion. and removed S-waiting-on-review Status: Awaiting review from the assignee but also interested parties. labels Jul 7, 2019
Centril added a commit to Centril/rust that referenced this pull request Jul 7, 2019
…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
bors added a commit that referenced this pull request Jul 7, 2019
Rollup of 4 pull requests

Successful merges:

 - #61883 (`non_ascii_idents` lint (part of RFC 2457))
 - #62042 (Support stability and deprecation checking for all macros)
 - #62213 (rustdoc: set cfg(doctest) when collecting doctests)
 - #62286 (Check if the archive has already been added to avoid duplicates)

Failed merges:

r? @ghost
@bors bors merged commit cff6ce6 into rust-lang:master Jul 7, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
S-waiting-on-bors Status: Waiting on bors to run and complete tests. Bors will change the label on completion. T-rustdoc Relevant to the rustdoc team, which will review and decide on the PR/issue.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants