Repository navigation
Enable --generate-link-to-definition rustdoc option on std docs - #162808
GuillaumeGomez wants to merge 5 commits into
Conversation
9b47485 to
b8ffb51
Compare
| $($code)* | ||
| } | ||
| #[cfg(doc)] | ||
| loop {} |
There was a problem hiding this comment.
This is a little hack to ensure that the code is not compiled and won't fail compilation whatever the return type since loop returns !.
This comment has been minimized.
This comment has been minimized.
b8ffb51 to
a514d28
Compare
This comment has been minimized.
This comment has been minimized.
a514d28 to
9dfeec6
Compare
This comment has been minimized.
This comment has been minimized.
9dfeec6 to
4e3ffaf
Compare
This comment has been minimized.
This comment has been minimized.
|
Seems like some work remains. Gonna convert it to draft for the time being. |
…Urgau [rustdoc] Correctly handle `dyn` trait methods linking for jump to def feature Part of the missing pieces for rust-lang#162808 to work. The issue was that in case we had the method of a dyn trait, we tried to use the dyn trait as is and couldn't generate a correct href to its `DefId`. If we get the trait in the `dyn`, it works just as expected. r? @Urgau
Rollup merge of #163036 - GuillaumeGomez:dyn-jump-to-def, r=Urgau [rustdoc] Correctly handle `dyn` trait methods linking for jump to def feature Part of the missing pieces for #162808 to work. The issue was that in case we had the method of a dyn trait, we tried to use the dyn trait as is and couldn't generate a correct href to its `DefId`. If we get the trait in the `dyn`, it works just as expected. r? @Urgau
… r=Urgau [rustdoc] Correctly check that an item is not `doc(hidden)` with `--generate-link-to-definition` Needed for rust-lang#162808. The problem was that we only checked the item itself, not any of its parents. Fixed by adding a loop. r? @Urgau
…ent, r=Urgau [rustdoc] Fix invalid jump to def link when `#[rustc_allow_incoherent_impl]` is involved Fixes rust-lang#163112. Problem here is that the method is not available in the crate where the type is defined. So `def_path` is actually problematic here as it resolves to the end item, which is not what we want. So instead, I made a simplified version of the `rustc_middle::ty::print::pretty::try_print_visible_def_path_recur` function. It's also needed for rust-lang#162808. r? @Urgau
There was a problem hiding this comment.
"everybody loops" returns?
There was a problem hiding this comment.
I'm not sure I understand the question so I'll answer to "Is it an issue to use this attribute macro if the function returns something other than ()". Answer: loop returns !, so it covers every types. It's a little trick we used at some point in rustdoc to remove function bodies (before we realized you could have impl inside any block).
There was a problem hiding this comment.
I was referring to the old everybody loops pass that rustdoc used to have, but then removed because it broke with RPIT. Seems like we have pretty much gone full circle except now you have to opt-in to the loop replacement instead.
|
💔 I suspect this PR failed tests as part of a rollup After fixing the problem, consider running a try job for the failed job before re-approving. Link to failure: #165000 (comment) |
|
This pull request was unapproved. This PR was contained in a rollup (#165000), which was unapproved. |
|
@bors try jobs=test-aarch64-msvc-2,test-x86_64-msvc-1 |
This comment has been minimized.
This comment has been minimized.
|
Wait, why is my new commit not there? And why is it "processing updates". Github... @bors cancel |
|
❗ There is currently no auto build in progress on this PR. Hint: There is a pending try build on this PR. Maybe you meant to cancel it? You can do that using |
|
@bors try cancel |
|
Try build cancelled. Cancelled workflows: Hint: if you want to run another try build, you do not need to manually cancel the previous one. Just run |
|
@bors try jobs=test-aarch64-msvc-2,test-x86_64-msvc-1 |
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
…td::no_code` macro
|
This PR was rebased onto a different main commit. Here's a range-diff highlighting what actually changed. Rebasing is a normal part of keeping PRs up to date, so no action is needed—this note is just to help reviewers. |
|
Rebased just in case. Also let's retry the previous jobs. @bors try jobs=test-aarch64-msvc-2,test-x86_64-msvc-1 |
This comment has been minimized.
This comment has been minimized.
|
@bors r=Amanieu |
View all comments
In the future (unclear at which point), rustdoc plans to get closer to the rust compiler and compile more of the code, making the
stdcode not compile anymore because of all thecfg(doc)in it to present a unified API to our users. To fix it (although incompletely), we can use the--generate-link-to-definitionrustdoc option (which we already use in the compiler docs) which requires to query more information and fails with currentstdcode. This PR fixes these errors and prevent regressions by enabling the new rustdoc option.r? @Amanieu