Skip to content

Tracking issue for normalizing (evaluating) types in rustdoc-generated docs (-Z normalize-docs) #82692

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

Open
2 of 5 tasks
jyn514 opened this issue Mar 2, 2021 · 4 comments
Open
2 of 5 tasks
Labels
-Znormalize-docs Unstable rustdoc option: Normalize/evaluate types when generating docs A-associated-items Area: Associated items (types, constants & functions) C-tracking-issue Category: An issue tracking the progress of sth. like the implementation of an RFC S-tracking-design-concerns Status: There are blocking design concerns. S-tracking-impl-incomplete Status: The implementation is incomplete. T-rustdoc Relevant to the rustdoc team, which will review and decide on the PR/issue.

Comments

@jyn514
Copy link
Member

jyn514 commented Mar 2, 2021

This is a tracking issue for the rustdoc feature -Z normalize-docs. This normalizes projections like <Vec<T> as IntoIterator>::IntoIter to std::vec::IntoIter<T> in the generated documentation.

About tracking issues

Tracking issues are used to record the overall progress of implementation.
They are also used as hubs connecting to other relevant issues, e.g., bugs or open design questions.
A tracking issue is however not meant for large scale discussion, questions, or bug reports about a feature.
Instead, open a dedicated issue for the specific matter and add the relevant feature gate label.

Steps

Unresolved Questions

No unresolved questions known, this is "just hard".

Implementation history

@jyn514 jyn514 added T-rustdoc Relevant to the rustdoc team, which will review and decide on the PR/issue. A-associated-items Area: Associated items (types, constants & functions) C-tracking-issue Category: An issue tracking the progress of sth. like the implementation of an RFC labels Mar 2, 2021
matthiaskrgr added a commit to matthiaskrgr/rust that referenced this issue Dec 1, 2021
Add tests for `normalize-docs` overflow errors

`@b-naber` do you understand why using `try_normalize_erasing_regions` doesn't silence these cycle errors? Rustdoc isn't emitting them, rustc is aborting before returning an error, even though the function has `try_` in the name.

cc rust-lang#82692, rust-lang#91255
@jyn514 jyn514 added the -Znormalize-docs Unstable rustdoc option: Normalize/evaluate types when generating docs label Dec 16, 2022
@workingjubilee workingjubilee added the A-CLI Area: Command-line interface (CLI) to the compiler label Mar 5, 2023
@jyn514

This comment was marked as resolved.

@workingjubilee workingjubilee removed the A-CLI Area: Command-line interface (CLI) to the compiler label Jul 7, 2023
@workingjubilee

This comment was marked as resolved.

@fmease fmease added S-tracking-design-concerns Status: There are blocking design concerns. S-tracking-impl-incomplete Status: The implementation is incomplete. labels May 2, 2024
@fmease
Copy link
Member

fmease commented May 2, 2024

Apart from marking the impl as S-tracking-impl-incomplete Status: The implementation is incomplete. / “incomplete” (buggy), I'm marking it as S-tracking-design-concerns Status: There are blocking design concerns. because there have been lots of discussions around the question whether we want to normalize/evaluate constant expressions in rustdoc at all1 (“intent” vs. “representation”) and by extension the same concern applies to types. See #102456, #99630, Zulip discussion.

Footnotes

  1. Or rather only if the corresponding item was marked with a new attribute.

@fmease
Copy link
Member

fmease commented May 25, 2025

In rust-lang/rfcs#3770 (review) I just wrote:


[…]

  1. A subgroup of users would like rustdoc to normalize types. Type normalization almost became the default (Normalize <X as Y>::T for rustdoc #77467) but due to limitations of the current (but not next-gen) trait solver (namely: fatal overflows), it had to be gated behind the -Znormalize-docs where this behavior currently resides. Also, rustdoc is notoriously bad at properly tracking binders (think higher-ranked lifetimes). It's gotten better but it's not sufficient (cc use ObligationCtxt not QueryNormalizer in rustdoc's normalization  #108503).
  2. A subgroup of users would like public type aliases to remain unexpanded and private ones to be folded away. This is what rustdoc currently does for items of the local crate. Infamously, this does not extend to inlined cross-crate re-exports (rustdoc: reexported type aliases are not preserved in function signatures #15823) as they use a different IR (middle IR vs HIR). This has created the multi-year effort of representing type aliases in the "type/trait system IR" (aka middle::ty). See Tracking issue for lazy type aliases #112792.

However, [1] (type normalization) is inherently incompatible with [2] (public type alias preservation). I'm currently driving [2] and will block any attempt at stabilizing [1] :P (not that there was any push to do so). This screams "we'd like to have configuration".

@fmease fmease changed the title Tracking Issue for -Z normalize-docs Tracking issue for normalize (evaluate) types in rustdoc-generated docs (-Z normalize-docs) May 25, 2025
@fmease fmease changed the title Tracking issue for normalize (evaluate) types in rustdoc-generated docs (-Z normalize-docs) Tracking issue for normalizing (evaluating) types in rustdoc-generated docs (-Z normalize-docs) May 25, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
-Znormalize-docs Unstable rustdoc option: Normalize/evaluate types when generating docs A-associated-items Area: Associated items (types, constants & functions) C-tracking-issue Category: An issue tracking the progress of sth. like the implementation of an RFC S-tracking-design-concerns Status: There are blocking design concerns. S-tracking-impl-incomplete Status: The implementation is incomplete. T-rustdoc Relevant to the rustdoc team, which will review and decide on the PR/issue.
Projects
None yet
Development

No branches or pull requests

4 participants