-
Notifications
You must be signed in to change notification settings - Fork 12.8k
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
Reland #83738: "rustdoc: Don't load all extern crates unconditionally" #88215
Conversation
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
use crate::html::markdown::markdown_links; | ||
use crate::passes::collect_intra_doc_links::preprocess_link; | ||
|
||
// FIXME: this probably needs to consider inlining |
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.
Ugh, apparently github dropped my comment because I wrote it on a commit instead of the PR itself. Do you happen to have it in your email? If not I can try to rewrite it from memory, it was discussing exactly how this bug could happen and how I don't know how to test it with a UI test.
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.
No, I don't see any traces of the extended version of this comment in my mail.
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.
Ok, it went something like this: "inlining" is refering to doc(inline)
, not #[inline]
. The test case for it would look something like:
// inner_crate
pub fn foo() {}
// middle_crate
/// Link to [inner_crate::foo]
pub fn bar() {}
// outer_crate
pub use middle_crate::bar;
In particular, the first time inner_crate
will be loaded is when resolving the links on bar
, which I don't think this pass will catch because it doesn't look at the attributes of the original definition, only of the re-export.
I'm not sure how to test this with a UI test because it requires three nested crates, and AFAIK aux-build
only supports two.
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.
Seems to work fine when testing locally though 🤷 so this is probably ok.
This reverts commit 5f0c54d.
r=me with #88215 (comment) addressed. |
- All attributes for an item need to be considered at once, they can't be considered a line at a time. - The top-level crate was not being visited. This bug was caught by `extern-crate-used-only-in-link`, which I'm very glad I added. - Make the loader private to the module, so that only one function is exposed.
@bors r=petrochenkov |
📌 Commit c60a370 has been approved by |
…arth Rollup of 11 pull requests Successful merges: - rust-lang#87832 (Fix debugger stepping behavior with `match` expressions) - rust-lang#88123 (Make spans for tuple patterns in E0023 more precise) - rust-lang#88215 (Reland rust-lang#83738: "rustdoc: Don't load all extern crates unconditionally") - rust-lang#88216 (Don't stabilize creation of TryReserveError instances) - rust-lang#88270 (Handle type ascription type ops in NLL HRTB diagnostics) - rust-lang#88289 (Fixes for LLVM change 0f45c16) - rust-lang#88320 (type_implements_trait consider obligation failure on overflow) - rust-lang#88332 (Add argument types tait tests) - rust-lang#88340 (Add `c_size_t` and `c_ssize_t` to `std::os::raw`.) - rust-lang#88346 (Revert "Add type of a let tait test impl trait straight in let") - rust-lang#88348 (Add field types tait tests) Failed merges: r? `@ghost` `@rustbot` modify labels: rollup
…trochenkov rustdoc: Go back to loading all external crates unconditionally This *continues* to cause regressions. This code will be unnecessary once access to the resolver happens fully before creating the tyctxt (rust-lang#83761), so load all crates unconditionally for now. To minimize churn, this leaves in the code for loading crates selectively. "Fixes" rust-lang#84738. Previously: rust-lang#83738, rust-lang#85749, rust-lang#88215 r? `@petrochenkov` cc `@camelid` (this should fix the "index out of bounds" error you had while looking up `crate_name`).
…ochenkov rustdoc: Go back to loading all external crates unconditionally This *continues* to cause regressions. This code will be unnecessary once access to the resolver happens fully before creating the tyctxt (rust-lang#83761), so load all crates unconditionally for now. To minimize churn, this leaves in the code for loading crates selectively. "Fixes" rust-lang#84738. Previously: rust-lang#83738, rust-lang#85749, rust-lang#88215 r? `@petrochenkov` cc `@camelid` (this should fix the "index out of bounds" error you had while looking up `crate_name`).
I hopefully found all the bugs 🤞 time for a take two. See the last commit for details on what went wrong before.
r? @petrochenkov (but feel free to reassign to Guillaume if you don't have time.)
Closes #68427. Includes a fix for #84738.