Skip to content

rustdoc: Fix visibility of trait and impl items #81288

New issue

Have a question about this project? # for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “#”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? # to your account

Merged
merged 1 commit into from
Jan 24, 2021

Conversation

camelid
Copy link
Member

@camelid camelid commented Jan 22, 2021

Fixes #81274.

r? @jyn514

@camelid camelid added A-visibility Area: Visibility / privacy T-rustdoc Relevant to the rustdoc team, which will review and decide on the PR/issue. beta-nominated Nominated for backporting to the compiler in the beta channel. labels Jan 22, 2021
@rust-highfive rust-highfive added the S-waiting-on-review Status: Awaiting review from the assignee but also interested parties. label Jan 22, 2021
@camelid
Copy link
Member Author

camelid commented Jan 22, 2021

Beta-nominated since this is a regression from stable to beta. Not sure if it's worth backporting, but we should definitely consider it.

@rust-log-analyzer
Copy link
Collaborator

The job mingw-check failed! Check out the build log: (web) (plain)

Click to see the possible cause of the failure (guessed by this bot)
configure: rust.channel         := nightly
configure: rust.debug-assertions := True
configure: llvm.assertions      := True
configure: dist.missing-tools   := True
configure: build.configure-args := ['--enable-sccache', '--disable-manage-submodu ...
configure: writing `config.toml` in current directory
configure: 
configure: run `python /checkout/x.py --help`
configure: 
---
skip untracked path cpu-usage.csv during rustfmt invocations
skip untracked path src/doc/book/ during rustfmt invocations
skip untracked path src/doc/rust-by-example/ during rustfmt invocations
skip untracked path src/llvm-project/ during rustfmt invocations
Diff in /checkout/src/librustdoc/clean/mod.rs at line 1096:
                     AssocTypeItem(bounds.clean(cx), default.clean(cx))
             };
             };
-            let what_rustc_thinks = Item::from_def_id_and_parts(local_did, Some(self.ident.name), inner, cx);
+            let what_rustc_thinks =
+                Item::from_def_id_and_parts(local_did, Some(self.ident.name), inner, cx);
             // Trait items always have the trait's visibility -- we don't want to show `pub`.
             Item { visibility: Inherited, ..what_rustc_thinks }
         })
Diff in /checkout/src/librustdoc/clean/mod.rs at line 1133:
                 }
             };
             };
-            let what_rustc_thinks = Item::from_def_id_and_parts(local_did, Some(self.ident.name), inner, cx);
+            let what_rustc_thinks =
+                Item::from_def_id_and_parts(local_did, Some(self.ident.name), inner, cx);
             // Trait impl items always have the trait's/impl's visibility --
             // we don't want to show `pub`.
             Item { visibility: Inherited, ..what_rustc_thinks }
Running `"/checkout/obj/build/x86_64-unknown-linux-gnu/stage0/bin/rustfmt" "--config-path" "/checkout" "--edition" "2018" "--unstable-features" "--skip-children" "--check" "/checkout/src/librustdoc/clean/mod.rs"` failed.
If you're running `tidy`, try again with `--bless`. Or, if you just want to format code, run `./x.py fmt` instead.
Build completed unsuccessfully in 0:00:20

Copy link
Member

@jyn514 jyn514 left a comment

Choose a reason for hiding this comment

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

r=me with CI passing

@jyn514 jyn514 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 Jan 23, 2021
@camelid camelid force-pushed the fix-trait-item-vis branch from 30e8fc3 to 10a7df7 Compare January 23, 2021 01:22
@rust-log-analyzer

This comment has been minimized.

@camelid
Copy link
Member Author

camelid commented Jan 23, 2021

CI caught a bug: impls are not always trait impls!

@camelid camelid force-pushed the fix-trait-item-vis branch from 10a7df7 to 659d515 Compare January 23, 2021 02:27
@camelid camelid 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 Jan 23, 2021
@camelid
Copy link
Member Author

camelid commented Jan 23, 2021

@jyn514 CI should pass now, but I think you should re-review as the behavior has changed.

@camelid camelid force-pushed the fix-trait-item-vis branch from 659d515 to 93e51b1 Compare January 23, 2021 02:30
@jyn514
Copy link
Member

jyn514 commented Jan 23, 2021

@bors r+

Looks great, thanks!

@bors
Copy link
Collaborator

bors commented Jan 23, 2021

📌 Commit 93e51b1 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 Jan 23, 2021
bors added a commit to rust-lang-ci/rust that referenced this pull request Jan 23, 2021
…as-schievink

Rollup of 15 pull requests

Successful merges:

 - rust-lang#79841 (More clear documentation for NonNull<T>)
 - rust-lang#81072 (PlaceRef::ty: use method call syntax)
 - rust-lang#81130 (Edit rustc_middle::dep_graph module documentation)
 - rust-lang#81170 (Avoid hash_slice in VecDeque's Hash implementation)
 - rust-lang#81243 (mir: Improve size_of handling when arg is unsized)
 - rust-lang#81245 (Update cargo)
 - rust-lang#81249 (Lower closure prototype after its body.)
 - rust-lang#81252 (Add more self-profile info to rustc_resolve)
 - rust-lang#81275 (Fix <unknown> queries and add more timing info to render_html)
 - rust-lang#81281 (Inline methods of Path and OsString)
 - rust-lang#81283 (Note library tracking issue template in tracking issue template.)
 - rust-lang#81285 (Remove special casing of rustdoc in rustc_lint)
 - rust-lang#81288 (rustdoc: Fix visibility of trait and impl items)
 - rust-lang#81298 (replace RefCell with Cell in FnCtxt)
 - rust-lang#81301 (Fix small typo)

Failed merges:

r? `@ghost`
`@rustbot` modify labels: rollup
@bors bors merged commit 64cf8c2 into rust-lang:master Jan 24, 2021
@rustbot rustbot added this to the 1.51.0 milestone Jan 24, 2021
@camelid camelid deleted the fix-trait-item-vis branch January 24, 2021 00:43
@apiraino apiraino added the beta-accepted Accepted for backporting to the compiler in the beta channel. label Jan 28, 2021
@ehuss ehuss mentioned this pull request Feb 5, 2021
@ehuss ehuss removed the beta-nominated Nominated for backporting to the compiler in the beta channel. label Feb 5, 2021
ehuss pushed a commit to ehuss/rust that referenced this pull request Feb 5, 2021
rustdoc: Fix visibility of trait and impl items

Fixes rust-lang#81274.

r? `@jyn514`
bors added a commit to rust-lang-ci/rust that referenced this pull request Feb 6, 2021
[beta] backports

This backports:

* CI: only copy python.exe to python3.exe if the latter does not exist rust-lang#81762
* Make hitting the recursion limit in projection non-fatal rust-lang#81055
* Remove incorrect `delay_span_bug` rust-lang#81532
* introduce future-compatibility warning for forbidden lint groups rust-lang#81556
* Update cargo rust-lang#81755
* rustdoc: Fix visibility of trait and impl items rust-lang#81288
* Work around missing -dev packages in solaris docker image. rust-lang#81229
* Update LayoutError/LayoutErr stability attributes rust-lang#81767
* Revert 78373 ("dont leak return value after panic in drop") rust-lang#81257
* Rename `panic_fmt` lint to `non_fmt_panic` rust-lang#81729
# for free to join this conversation on GitHub. Already have an account? # to comment
Labels
A-visibility Area: Visibility / privacy beta-accepted Accepted for backporting to the compiler in the beta channel. 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.

Wrong pub modifier in each function of trait documentation
8 participants