Skip to content
New issue

Have a question about this project? # for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “#”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? # to your account

Query docs show return types as <query_name as QueryConfig<TyCtxt<'tcx>>>::Stored #77459

Closed
jyn514 opened this issue Oct 2, 2020 · 7 comments · Fixed by #77467
Closed

Query docs show return types as <query_name as QueryConfig<TyCtxt<'tcx>>>::Stored #77459

jyn514 opened this issue Oct 2, 2020 · 7 comments · Fixed by #77467
Labels
A-contributor-roadblock Area: Makes things more difficult for new or seasoned contributors to Rust T-compiler Relevant to the compiler team, which will review and decide on the PR/issue. T-rustdoc Relevant to the rustdoc team, which will review and decide on the PR/issue.

Comments

@jyn514
Copy link
Member

jyn514 commented Oct 2, 2020

e.g. https://doc.rust-lang.org/nightly/nightly-rustc/rustc_middle/ty/struct.TyCtxt.html#method.hir_crate

This makes the docs really hard to read: you have to click on hir_crate, open impl<'tcx> QueryConfig<TyCtxt<'tcx>> for hir_crate, and know that Value is what actually matters, not Stored. This is super confusing and not documented anywhere. We should find a way to just put &'tcx Crate<'tcx> directly in the return type instead.

@jyn514 jyn514 added T-compiler Relevant to the compiler team, which will review and decide on the PR/issue. A-contributor-roadblock Area: Makes things more difficult for new or seasoned contributors to Rust labels Oct 2, 2020
@jyn514
Copy link
Member Author

jyn514 commented Oct 2, 2020

@jyn514
Copy link
Member Author

jyn514 commented Oct 2, 2020

I'm not sure what's going on with Stored here:
eval_to_const_value_raw returns EvalToConstValueResult (not a borrow), while
generics_of returns &ty::Generics (a borrow). However in the query file both of them are listed as returning an owned value.

@jyn514
Copy link
Member Author

jyn514 commented Oct 2, 2020

I think the difference is that generics_of uses ArenaCache, which returns a borrow? ugh

@jyn514
Copy link
Member Author

jyn514 commented Oct 2, 2020

Maybe the fix should be for rustdoc to turn <X as Y>::Assoc into the actual type that describes? That would make the standard library docs easier to read too.

@jyn514 jyn514 added the T-rustdoc Relevant to the rustdoc team, which will review and decide on the PR/issue. label Oct 2, 2020
@bors bors closed this as completed in 65ecc48 Nov 26, 2020
@jyn514
Copy link
Member Author

jyn514 commented Nov 28, 2020

Re-opening this until I fix #79459 properly.

@jyn514 jyn514 reopened this Nov 28, 2020
Dylan-DPC-zz pushed a commit to Dylan-DPC-zz/rust that referenced this issue Nov 29, 2020
…n1011

Remove unnecessary `mut` binding

Found while fiddling around with rust-lang#77459.
m-ou-se added a commit to m-ou-se/rust that referenced this issue Dec 1, 2020
…illaumeGomez

Add -Z normalize-docs and enable it for compiler docs

Works around rust-lang#79459 by only enabling normalization for the compiler itself (and anyone who opts-in on nightly). Eventually I want to remove this and enable normalization by default, but that's turned out to be [really hard](https://rust-lang.zulipchat.com/#narrow/stream/182449-t-compiler.2Fhelp/topic/How.20do.20I.20normalize.20projection.20types.20to.20a.20single.20type.3F/near/218125195).

This uses a command line option instead of a feature gate so it's easier to pass it to all crates at once. Theoretically it's better to use a feature gate instead so that it's easier for people to use on docs.rs, but I'm also not terribly concerned with how easy it to use a temporary hack.

Addresses rust-lang#77459.
m-ou-se added a commit to m-ou-se/rust that referenced this issue Dec 1, 2020
…illaumeGomez

Add -Z normalize-docs and enable it for compiler docs

Works around rust-lang#79459 by only enabling normalization for the compiler itself (and anyone who opts-in on nightly). Eventually I want to remove this and enable normalization by default, but that's turned out to be [really hard](https://rust-lang.zulipchat.com/#narrow/stream/182449-t-compiler.2Fhelp/topic/How.20do.20I.20normalize.20projection.20types.20to.20a.20single.20type.3F/near/218125195).

This uses a command line option instead of a feature gate so it's easier to pass it to all crates at once. Theoretically it's better to use a feature gate instead so that it's easier for people to use on docs.rs, but I'm also not terribly concerned with how easy it to use a temporary hack.

Addresses rust-lang#77459.
@jyn514
Copy link
Member Author

jyn514 commented Dec 12, 2020

This was fixed for rustc by #79525. I guess we can reuse this as the tracking issue for enabling normalize-docs globally? I'm not planning to work on it myself but I'd love to remove the feature gate.

@jyn514
Copy link
Member Author

jyn514 commented Mar 2, 2021

Closing this in favor of #82692, which has proper links and such so it's clear what this is blocked on.

@jyn514 jyn514 closed this as completed Mar 2, 2021
# for free to join this conversation on GitHub. Already have an account? # to comment
Labels
A-contributor-roadblock Area: Makes things more difficult for new or seasoned contributors to Rust T-compiler Relevant to the compiler team, which will review and decide on the PR/issue. T-rustdoc Relevant to the rustdoc team, which will review and decide on the PR/issue.
Projects
None yet
Development

Successfully merging a pull request may close this issue.

1 participant