[rustdoc] Fix invalid jump to def link when #[rustc_allow_incoherent_impl] is involved - #163133
Conversation
#[rustc_allow_incoherent_impl] is involved#[rustc_allow_incoherent_impl] is involved
480e1c2 to
e2275ae
Compare
| // `#[rustc_allow_incoherent_impl]` and we need to keep the non-final item path. | ||
| // Sadly if we use `item_relative_path` which uses `def_path`, it renders the final | ||
| // item path and not the intermediate one. | ||
| && let Some(fqp) = transitive_reexport_path(tcx, def_id) |
There was a problem hiding this comment.
Just asking like this, but can't we always use transitive_reexport_path? maybe with a fallback to item_relative_path.
There was a problem hiding this comment.
We could, but it's likely much slower and also it would not link to the final item anymore if there are transitive crates.
There was a problem hiding this comment.
also it would not link to the final item anymore if there are transitive crates.
Do we have a test case for this? If not we should add one.
There was a problem hiding this comment.
All the reexport ones I assume?
e2275ae to
3f06201
Compare
|
Applied suggestion. |
This comment has been minimized.
This comment has been minimized.
3f06201 to
3e0a490
Compare
|
Applied it correctly this time. ^^' |
This comment has been minimized.
This comment has been minimized.
3e0a490 to
5f0e4be
Compare
|
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. |
|
Fixed merge conflict. |
| } | ||
|
|
||
| let visible_parent = visible_parent_map.get(&def_id).cloned()?; | ||
| if tcx.is_doc_hidden(visible_parent) { |
There was a problem hiding this comment.
Do we need/do we wantr to take into account --document-private-items here?
There was a problem hiding this comment.
Not too sure about that. I'll add a fixme comment so it's not forgotten and I'll try to find a case where it fails.
5f0e4be to
21c6277
Compare
|
@bors 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
…uwer Rollup of 7 pull requests Successful merges: - #162493 (Add support for -Zsanitizer-cfi-minimal-runtime) - #163133 ([rustdoc] Fix invalid jump to def link when `#[rustc_allow_incoherent_impl]` is involved) - #163215 (Fix suggestion for Option to bool with proper precedence handling) - #163266 (More deferred liveness cleanups) - #163274 (Support -Z merge-functions with gcc and add stack-protector asm tests) - #163312 (Add rustdoc regression test for glob import of a crate that re-exports) - #163332 (Add some docs to `Global`)
Rollup of 13 pull requests Successful merges: - #160695 (Detect bad number of generics caused by bad derive) - #162883 (No longer auto-inline `f16` and `f128` on well-supported platforms) - #163133 ([rustdoc] Fix invalid jump to def link when `#[rustc_allow_incoherent_impl]` is involved) - #163215 (Fix suggestion for Option to bool with proper precedence handling) - #163266 (More deferred liveness cleanups) - #163274 (Support -Z merge-functions with gcc and add stack-protector asm tests) - #163290 (Merge `ForceWarning`/`Allow`/`Expect` into `Warning`) - #163298 (Don't emit sugg for pub-reexport extern std) - #163312 (Add rustdoc regression test for glob import of a crate that re-exports) - #163357 (Borrowck cleanups part trois) - #161710 (Stabilize `mem::conjure_zst`) - #163332 (Add some docs to `Global`) - #163362 (simplify ndk compiler test)
Rollup merge of #163133 - GuillaumeGomez:jump-to-def-incoherent, r=Urgau [rustdoc] Fix invalid jump to def link when `#[rustc_allow_incoherent_impl]` is involved Fixes #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 #162808. r? @Urgau
Rollup of 13 pull requests Successful merges: - rust-lang/rust#160695 (Detect bad number of generics caused by bad derive) - rust-lang/rust#162883 (No longer auto-inline `f16` and `f128` on well-supported platforms) - rust-lang/rust#163133 ([rustdoc] Fix invalid jump to def link when `#[rustc_allow_incoherent_impl]` is involved) - rust-lang/rust#163215 (Fix suggestion for Option to bool with proper precedence handling) - rust-lang/rust#163266 (More deferred liveness cleanups) - rust-lang/rust#163274 (Support -Z merge-functions with gcc and add stack-protector asm tests) - rust-lang/rust#163290 (Merge `ForceWarning`/`Allow`/`Expect` into `Warning`) - rust-lang/rust#163298 (Don't emit sugg for pub-reexport extern std) - rust-lang/rust#163312 (Add rustdoc regression test for glob import of a crate that re-exports) - rust-lang/rust#163357 (Borrowck cleanups part trois) - rust-lang/rust#161710 (Stabilize `mem::conjure_zst`) - rust-lang/rust#163332 (Add some docs to `Global`) - rust-lang/rust#163362 (simplify ndk compiler test)
View all comments
Fixes #163112.
Problem here is that the method is not available in the crate where the type is defined. So
def_pathis actually problematic here as it resolves to the end item, which is not what we want. So instead, I made a simplified version of therustc_middle::ty::print::pretty::try_print_visible_def_path_recurfunction.It's also needed for #162808.
r? @Urgau