-
Notifications
You must be signed in to change notification settings - Fork 12.7k
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: Always warn when linking from public to private items #74460
rustdoc: Always warn when linking from public to private items #74460
Conversation
(rust_highfive has picked a reviewer for you, use r? to override) |
r? @jyn514 |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Maybe this is a little over-protective after all, the warnings will still show up if you don't pass --document-private-items
. I'm willing to be convinced either way.
I don't have a strong opinion on this as well. Your comment in #74147 (comment) did make sense to me and still does imo. How does the current stabilization plan relate to this? Is it possible to change when a warning triggers after intro-doc links hit stable? |
I think my concern is that the lint name
See #43466 (comment):
|
Another alternative is make this a separate lint altogether: |
I see your point about the lint's name not quite fitting the Considering that, the suggested additional There is of course the third option of doing nothing for now. @jyn514? Maybe @Manishearth has an opinion as well? |
I think an additional note would work! I think it's fine to consider this a "resolution failure". |
Note that when you attempt to import something private from a different crate, rustc throws a similar resolution error with a note iirc. |
I went ahead and added notes for both cases as suggested. |
Change the logic such that linking from a public to a private item always triggers intra_doc_link_resolution_failure. Previously, the warning was not emitted when --document-private-items is passed. Also don't rely anymore on the item's visibility, which would falsely trigger the lint now that the check for --document-private-items is gone.
…links The additional note helps explaining why the lint was triggered and that --document-private-items directly influences the link resolution.
a99e2b1
to
c14641a
Compare
@bors r+ |
📌 Commit c14641a has been approved by |
🌲 The tree is currently closed for pull requests below priority 5, this pull request will be tested once the tree is reopened |
Rebased onto |
…arth Rollup of 9 pull requests Successful merges: - rust-lang#73783 (Detect when `'static` obligation might come from an `impl`) - rust-lang#73868 (Advertise correct stable version for const control flow) - rust-lang#74460 (rustdoc: Always warn when linking from public to private items) - rust-lang#74538 (Guard against non-monomorphized type_id intrinsic call) - rust-lang#74541 (Add the aarch64-apple-darwin target ) - rust-lang#74600 (Enable perf try builder) - rust-lang#74618 (Do not ICE on assoc type with bad placeholder) - rust-lang#74631 (rustc_target: Add a target spec option for disabling `--eh-frame-hdr`) - rust-lang#74643 (build: Remove unnecessary `cargo:rerun-if-env-changed` annotations) Failed merges: r? @ghost
Change the logic such that linking from a public to a private item always triggers
intra_doc_link_resolution_failure
.Previously, the warning was not emitted when
--document-private-items
is passed.This came up during the discussion in #74147 (comment).