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

Split doc_cfg and doc_auto_cfg features #90502

Merged
merged 2 commits into from
Nov 3, 2021

Conversation

GuillaumeGomez
Copy link
Member

Part of #90497.

With this feature, doc_cfg won't pick up items automatically anymore.

cc @Mark-Simulacrum
r? @jyn514

@GuillaumeGomez GuillaumeGomez added the T-rustdoc Relevant to the rustdoc team, which will review and decide on the PR/issue. label Nov 2, 2021
@rust-highfive rust-highfive added the S-waiting-on-review Status: Awaiting review from the assignee but also interested parties. label Nov 2, 2021
@rust-log-analyzer

This comment has been minimized.

compiler/rustc_feature/src/active.rs Outdated Show resolved Hide resolved
src/librustdoc/clean/types.rs Show resolved Hide resolved
@jyn514 jyn514 added beta-nominated Nominated for backporting to the compiler in the beta channel. S-waiting-on-author Status: This is awaiting some action (such as code changes or more information) from the author. and removed S-waiting-on-review Status: Awaiting review from the assignee but also interested parties. labels Nov 2, 2021
@rust-log-analyzer

This comment has been minimized.

@GuillaumeGomez GuillaumeGomez force-pushed the split-doc-cfg-feature branch 2 times, most recently from 75dddfe to 7052668 Compare November 2, 2021 15:34
@GuillaumeGomez GuillaumeGomez 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 Nov 2, 2021
@GuillaumeGomez
Copy link
Member Author

Ok, let's see if tidy is happy now. :)

@rust-log-analyzer

This comment has been minimized.

@jyn514
Copy link
Member

jyn514 commented Nov 2, 2021

@GuillaumeGomez do you mind updating tidy to also look in src/test/rustdoc? It already special cases rustdoc-ui, I don't think adding the new folder should be hard.

@GuillaumeGomez
Copy link
Member Author

Ah so that's what I thought. Adding a check in tidy then.

@GuillaumeGomez
Copy link
Member Author

Ah perfect, seems like CI passed this time! \o/

@jyn514
Copy link
Member

jyn514 commented Nov 2, 2021

@bors r+

@bors
Copy link
Contributor

bors commented Nov 2, 2021

📌 Commit d7afbf6 has been approved by jyn514

@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 Nov 2, 2021
@camelid
Copy link
Member

camelid commented Nov 2, 2021

This PR is beta-nominated. Does it make more sense to just disable doc_cfg on beta? cc @rust-lang/rustdoc for backport discussion

bors added a commit to rust-lang-ci/rust that referenced this pull request Nov 3, 2021
…askrgr

Rollup of 6 pull requests

Successful merges:

 - rust-lang#90084 (Make printed message match the code comment)
 - rust-lang#90354 (Document clippy on nightly-rustc)
 - rust-lang#90417 (stabilize `relaxed_struct_unsize`)
 - rust-lang#90472 (Clarify what to do with accepted feature gates)
 - rust-lang#90500 (Update Clippy dependencies)
 - rust-lang#90502 (Split doc_cfg and doc_auto_cfg features)

Failed merges:

r? `@ghost`
`@rustbot` modify labels: rollup
@bors bors merged commit e38844a into rust-lang:master Nov 3, 2021
@rustbot rustbot added this to the 1.58.0 milestone Nov 3, 2021
@GuillaumeGomez GuillaumeGomez deleted the split-doc-cfg-feature branch November 3, 2021 09:22
@apiraino
Copy link
Contributor

Beta backport accepted as per compiler team on Zulip

@rustbot label +beta-accepted

@rustbot rustbot added the beta-accepted Accepted for backporting to the compiler in the beta channel. label Nov 11, 2021
@cuviper cuviper mentioned this pull request Nov 16, 2021
@cuviper cuviper removed the beta-nominated Nominated for backporting to the compiler in the beta channel. label Nov 16, 2021
@cuviper cuviper modified the milestones: 1.58.0, 1.57.0 Nov 16, 2021
@@ -688,6 +688,9 @@ declare_features! (
/// not changed from prior instances of the same struct (RFC #2528)
(incomplete, type_changing_struct_update, "1.58.0", Some(86555), None),

/// Tells rustdoc to automatically generate `#[doc(cfg(...))]`.
(active, doc_auto_cfg, "1.58.0", Some(43781), None),
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Since this was beta-accepted, I took the liberty of adjusting it to "1.57.0" in #90938. Would someone care to fix that on master as well?

bors added a commit to rust-lang-ci/rust that referenced this pull request Nov 19, 2021
[beta] backports

-  Fix assertion failures in OwnedHandle with windows_subsystem. rust-lang#88798
-  Ensure that pushing empty path works as before on verbatim paths rust-lang#89665
-  Feature gate + make must_not_suspend allow-by-default rust-lang#89826
-  Only use clone3 when needed for pidfd rust-lang#89930
-  Fix documentation header sizes rust-lang#90186
-  Fixes incorrect handling of ADT's drop requirements rust-lang#90218
-  Fix ICE when forgetting to Box a parameter to a Self::func call rust-lang#90221
-  Prevent duplicate caller bounds candidates by exposing default substs in Unevaluated rust-lang#90266
-  Update odht crate to 0.3.1 (big-endian bugfix) rust-lang#90403
-  rustdoc: Go back to loading all external crates unconditionally rust-lang#90489
-  Split doc_cfg and doc_auto_cfg features rust-lang#90502
-  Apply adjustments for field expression even if inaccessible rust-lang#90508
-  Warn for variables that are no longer captured rust-lang#90597
-  Properly register text_direction_codepoint_in_comment lint. rust-lang#90626
-  CI: Use ubuntu image to download openssl, curl sources, cacert.pem for x86 dist builds rust-lang#90457
-  Android is not GNU rust-lang#90834
-  Update llvm submodule rust-lang#90954

Additionally, this bumps the stage 0 compiler from beta to stable 1.56.1.

r? `@Mark-Simulacrum`
arqunis added a commit to arqunis/serenity that referenced this pull request Feb 25, 2022
Lots of things in the library are only compiled when certain features
are enabled. However, it is not always clear to the user that in order
to use an item, it will need features x, y, and z, because by default,
this information is not shown.

Fortunately, a feature in `rustdoc` is being developed to provide such
information in the documentation, `doc_cfg`, which is usable right now
in Nightly Rust. To use it, you simply had to activate the feature
somewhere (preferably the crate root) using `#![feature(doc_cfg)]` and
then add `#[doc(cfg(feature = "x"))]` on an item to display that said
item requires the `x` feature. What is awesome about this is that it can
be automatically derived for all `#[cfg(...)]` instances for you.

Unfortunately, it was found out that the auto mode isn't appropriate in
all cases and may sometimes pick the wrong `#[cfg(...)]`. For this
reason, in the "Split doc_cfg and doc_auto_cfg features" pull
request[0], the auto mode has been split into a separate feature. This
commit changes the feature activation line in `lib.rs` to use
`doc_auto_cfg` instead of `doc_cfg`.

[0]: rust-lang/rust#90502
n8henrie added a commit to n8henrie/polars that referenced this pull request Jan 10, 2023
This makes it so one doesn't need to manually configure the
documentation cfg for feature flags.

rust-lang/rust#90502

Fixes pola-rs#6123
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
beta-accepted Accepted for backporting to the compiler in the beta channel. F-doc_cfg `#![feature(doc_cfg)]` 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.

9 participants