Skip to content
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

Do not use relative path in rustc doc #124028

Closed
mu001999 opened this issue Apr 16, 2024 · 5 comments · Fixed by #130625
Closed

Do not use relative path in rustc doc #124028

mu001999 opened this issue Apr 16, 2024 · 5 comments · Fixed by #130625
Assignees
Labels
A-docs Area: documentation for any part of the project, including the compiler, standard library, and tools C-bug Category: This is a bug. E-easy Call for participation: Easy difficulty. Experience needed to fix: Not much. Good first issue. T-compiler Relevant to the compiler team, which will review and decide on the PR/issue.

Comments

@mu001999
Copy link
Contributor

mu001999 commented Apr 16, 2024

We have some relative links in doc, e.g., the link of qpath_res in the comments for QPath:

/// Represents an optionally `Self`-qualified value/type path or associated extension.
///
/// To resolve the path to a `DefId`, call [`qpath_res`].
///
/// [`qpath_res`]: ../../rustc_middle/ty/struct.TypeckResults.html#method.qpath_res
#[derive(Debug, Clone, Copy, HashStable_Generic)]
pub enum QPath<'hir> { ... }

but we will get the Not Found page if we click it in https://doc.rust-lang.org/stable/nightly-rustc/rustc_hir/enum.QPath.html, which is re-exported.

So I think we can fix this by two ways:

  1. Don't use relative path in rustc doc
  2. Don't generate new link for re-exported items, use the same links with the original definition

but for the second option, we may have private middle mods, so it may be not a solution.

@mu001999 mu001999 added the C-bug Category: This is a bug. label Apr 16, 2024
@rustbot rustbot added the needs-triage This issue may need triage. Remove it if it has been sufficiently triaged. label Apr 16, 2024
@fmease
Copy link
Member

fmease commented Apr 19, 2024

cc #74481

@saethlin saethlin added E-easy Call for participation: Easy difficulty. Experience needed to fix: Not much. Good first issue. T-compiler Relevant to the compiler team, which will review and decide on the PR/issue. A-docs Area: documentation for any part of the project, including the compiler, standard library, and tools and removed needs-triage This issue may need triage. Remove it if it has been sufficiently triaged. labels Apr 28, 2024
@m1sk9
Copy link

m1sk9 commented Jun 15, 2024

I'm thinking of tackling this issue, is this Issue aimed at removing this invalid path once and for all?
(Sorry if I'm wrong as I'm trying to contribute for the first time)

@danik292
Copy link

@rustbot claim

@heiseish
Copy link
Contributor

Hi @danik292, just checking if you are still working on the issue? If so, apologies please ignore this. Otherwise I'm happy to take over. Thanks

@danik292
Copy link

@saethlin take it

@fmease fmease assigned heiseish and unassigned danik292 Sep 19, 2024
@bors bors closed this as completed in 6d41be2 Oct 10, 2024
rust-timer added a commit to rust-lang-ci/rust that referenced this issue Oct 10, 2024
Rollup merge of rust-lang#130625 - heiseish:issue-124028-fix, r=jieyouxu

Fix a few relative paths in rustc doc

## Changes

- Don't inline the doc for re-exporting some structs that have relative paths in doc.

## Context

See rust-lang#124028.

- Most of the relative links in rustdoc are there because of circular import (so syntax like `[MyType]: rustc_foo::bar` is difficult to achieve when we cannot import `rustc_xxx` due to circular import)
- Here, I disable new links for re-exports. I think it's fine for re-exported items in `hir::*`.
- There is a few more relative links in other `rustc` crates, however they are not addressed in this PR, as they are not re-exported and/so the relative paths are working.

Closes rust-lang#124028.

r​? `@fmease`

Let me know if I miss anything or there's any other way to address this issue.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
A-docs Area: documentation for any part of the project, including the compiler, standard library, and tools C-bug Category: This is a bug. E-easy Call for participation: Easy difficulty. Experience needed to fix: Not much. Good first issue. T-compiler Relevant to the compiler team, which will review and decide on the PR/issue.
Projects
None yet
Development

Successfully merging a pull request may close this issue.

7 participants