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 ty consistency fixes #93385

Merged
merged 5 commits into from
Mar 1, 2022
Merged

Conversation

CraftSpider
Copy link
Contributor

Changes to make rustdoc cleaning of ty more consistent with hir, and hopefully use it in more places.

r? @camelid

@rustbot rustbot added the T-rustdoc Relevant to the rustdoc team, which will review and decide on the PR/issue. label Jan 27, 2022
@rust-highfive rust-highfive added the S-waiting-on-review Status: Awaiting review from the assignee but also interested parties. label Jan 27, 2022
@CraftSpider CraftSpider marked this pull request as draft January 27, 2022 18:21
@CraftSpider CraftSpider marked this pull request as ready for review January 27, 2022 18:40
@rust-log-analyzer

This comment has been minimized.

@CraftSpider CraftSpider changed the title Rustdoc ty consistency fixees Rustdoc ty consistency fixes Jan 27, 2022
@camelid
Copy link
Member

camelid commented Jan 27, 2022

Can you squash the "Format" commit into the previous commit?

@camelid
Copy link
Member

camelid commented Jan 27, 2022

I reviewed the first few commits. I'll try to review the rest soon.

@camelid camelid added the C-cleanup Category: PRs that clean code up or issues documenting cleanup. label Jan 27, 2022
@CraftSpider
Copy link
Contributor Author

Format squashed in

Copy link
Member

@camelid camelid left a comment

Choose a reason for hiding this comment

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

This looks good to me overall but I'm a bit unclear about d90138b. Could you explain the goal of that commit? Also, the last commit doesn't actually make hir and ty use the same code paths so the commit message is a little confusing. Most of the code is actually still different. It'd probably be hard to fully merge them until type aliases are represented in ty though.

let mut names = if did.is_local() { &[] } else { cx.tcx.fn_arg_names(did) }.iter();
let mut names = did.map_or(&[] as &[_], |did| cx.tcx.fn_arg_names(did)).iter();
Copy link
Member

Choose a reason for hiding this comment

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

Hmm, could this be a behavior change when this is called with an external function? I think if it is, it'd be a bugfix, but I wanted to check. In the inline code path (inline.rs), this is called with Some(did), where did should be non-local.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

This should only change code on local functions, external functions always took the else case and are thus equivalent to Some. Local function behavior should be affected as an intentional fix related to this PR.

Copy link
Member

Choose a reason for hiding this comment

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

You're right, I got confused. Thanks!

@camelid
Copy link
Member

camelid commented Feb 11, 2022

Sorry for taking so long to review this by the way!

@camelid camelid added 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 Feb 11, 2022
@CraftSpider
Copy link
Contributor Author

Commit d90138b is reverting a change I made in an earlier PR that was necessary before these fixes - There's a JSON test that ensures removing it here didn't cause a regression. The comment about 'same code path' is meant to mean that the two different functions calculate what items are impl items the same way, not that they're fully the same code paths but that they should now use the same rules for what is an 'impl of a trait'.

@CraftSpider CraftSpider 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 Feb 15, 2022
Copy link
Member

@camelid camelid left a comment

Choose a reason for hiding this comment

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

Sorry again this took so long!

@camelid
Copy link
Member

camelid commented Mar 1, 2022

@bors r+

@bors
Copy link
Contributor

bors commented Mar 1, 2022

📌 Commit 2d2163b has been approved by camelid

@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 Mar 1, 2022
bors added a commit to rust-lang-ci/rust that referenced this pull request Mar 1, 2022
Rollup of 7 pull requests

Successful merges:

 - rust-lang#91545 (Generalize "remove `&`"  and "add `*`" suggestions to more than one deref)
 - rust-lang#93385 (Rustdoc ty consistency fixes)
 - rust-lang#93926 (Lint against more useless `#[must_use]` attributes)
 - rust-lang#94094 (use BOOL for TCP_NODELAY setsockopt value on Windows)
 - rust-lang#94384 (Add Atomic*::from_mut_slice)
 - rust-lang#94448 (5 - Make more use of `let_chains`)
 - rust-lang#94452 (Sync portable-simd for bitmasks &c.)

Failed merges:

r? `@ghost`
`@rustbot` modify labels: rollup
@bors bors merged commit 2fb5a16 into rust-lang:master Mar 1, 2022
@rustbot rustbot added this to the 1.61.0 milestone Mar 1, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
C-cleanup Category: PRs that clean code up or issues documenting cleanup. 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.

6 participants