Exclude "test" from doc_auto_cfg by GuillaumeGomez · Pull Request #92856 · rust-lang/rust (original) (raw)
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 andprivacy statement. We’ll occasionally send you account related emails.
Already on GitHub?Sign in to your account
Conversation21 Commits4 Checks0 Files changed
Conversation
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.Learn more about bidirectional Unicode characters
[ Show hidden characters]({{ revealButtonHref }})
Relevant to the rustdoc team, which will review and decide on the PR/issue.
label
Some changes occurred in clean/types.rs
.
cc @camelid
The rendered updated test looks like this:
| .filter_map(|attr| match Cfg::parse_without(attr.meta_item()?, &[sym::test]) { | | ------------------------------------------------------------------------------------ | | Ok(Some(c)) => Some(c), | | _ => None, | | }) | | .filter(|cfg| !hidden_cfg.contains(cfg)) |
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Couldn't we just add test
into the hidden_cfg
?
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Ah wait, that would need the other change to apply the hiding to sub-expressions rather than the expression as a whole.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yep, hence why I didn't. ;)
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I wonder if it would be good to make that change first, so we don't need the extra code here specifically to handle test
?
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
You mean putting test
in hidden_cfg
and then simply pass hidden_cfg
to Cfg::parse_without
instead of &[sym::test]
?
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yep, something like that.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Ok!
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@Nemo157: That won't be possible as is because cfg_hide
is to hide explicitly a cfg
(any(not(feature = "miri-test-libstd"), test, doctest)
for example) whereas this PR is to remove any appearances of test
. The goals are completely different.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Not really, test
is just a very simple cfg-expression that could be hidden as more complex expressions can. As mentioned on the linked issue we can have cfg_hide
hide arbitrary sub-expressions of the overall cfg
. So e.g. if test
is hidden any(not(test), foo)
would simplify to foo
, and if both test
and feature = "__internal"
are hidden then any(test, feature = "__internal")
would simplify to nothing at all.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Hum ok... Let me give it another try.
I rebased on top of master but didn't change anything else otherwise.
@Nemo157 It now removes cfg_hide
if they are inside "bigger" cfgs. Is it what you had in mind?
This comment has been minimized.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Couple of minor things that I think could be simplified, other than that looks great to me.
r=me with those simplified
📌 Commit b0df765 has been approved by Nemo157
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
bors added a commit to rust-lang-ci/rust that referenced this pull request
…askrgr
Rollup of 17 pull requests
Successful merges:
- rust-lang#91032 (Introduce drop range tracking to generator interior analysis)
- rust-lang#92856 (Exclude "test" from doc_auto_cfg)
- rust-lang#92860 (Fix errors on blanket impls by ignoring the children of generated impls)
- rust-lang#93038 (Fix star handling in block doc comments)
- rust-lang#93061 (Only suggest adding
!
to expressions that can be macro invocation) - rust-lang#93067 (rustdoc mobile: fix scroll offset when jumping to internal id)
- rust-lang#93086 (Add tests to ensure that
let_chains
works withif_let_guard
) - rust-lang#93087 (Fix src/test/run-make/raw-dylib-alt-calling-convention)
- rust-lang#93091 (⬆ chalk to 0.76.0)
- rust-lang#93094 (src/test/rustdoc-json: Check for
struct_field
s invariant_tuple_struct.rs
) - rust-lang#93098 (Show a more informative panic message when
DefPathHash
does not exist) - rust-lang#93099 (rustdoc: auto create output directory when "--output-format json")
- rust-lang#93102 (Pretty printer algorithm revamp step 3)
- rust-lang#93104 (Support --bless for pp-exact pretty printer tests)
- rust-lang#93114 (update comment for
ensure_monomorphic_enough
) - rust-lang#93128 (Add script to prevent point releases with same number as existing ones)
- rust-lang#93136 (Backport the 1.58.1 release notes to master)
Failed merges:
r? @ghost
@rustbot
modify labels: rollup
Labels
Status: Waiting on bors to run and complete tests. Bors will change the label on completion.
Relevant to the rustdoc team, which will review and decide on the PR/issue.