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 }})

GuillaumeGomez

@rustbot rustbot added the T-rustdoc

Relevant to the rustdoc team, which will review and decide on the PR/issue.

label

Jan 13, 2022

@rust-highfive

Some changes occurred in clean/types.rs.

cc @camelid

@GuillaumeGomez

The rendered updated test looks like this:
Screenshot from 2022-01-13 15-53-33

Nemo157

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

@camelid

@GuillaumeGomez

I rebased on top of master but didn't change anything else otherwise.

@GuillaumeGomez

@Nemo157 It now removes cfg_hide if they are inside "bigger" cfgs. Is it what you had in mind?

@rust-log-analyzer

This comment has been minimized.

Nemo157

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

@GuillaumeGomez

@bors

📌 Commit b0df765 has been approved by Nemo157

@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

Jan 20, 2022

bors added a commit to rust-lang-ci/rust that referenced this pull request

Jan 21, 2022

@bors

…askrgr

Rollup of 17 pull requests

Successful merges:

Failed merges:

r? @ghost @rustbot modify labels: rollup

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.