-
Notifications
You must be signed in to change notification settings - Fork 13.3k
TyCtxt::variances_of is misdocumented as applying to a generic parameter #133494
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
Labels
A-docs
Area: Documentation for any part of the project, including the compiler, standard library, and tools
A-variance
Area: Variance (https://doc.rust-lang.org/nomicon/subtyping.html)
T-compiler
Relevant to the compiler team, which will review and decide on the PR/issue.
Comments
Good catch, feel free to submit a patch! Small correction: ... of the *item given by the |
rust-timer
added a commit
to rust-lang-ci/rust
that referenced
this issue
Dec 27, 2024
Rollup merge of rust-lang#134787 - fmease:spruce-up-queries, r=compiler-errors Spruce up the docs of several queries related to the type/trait system and const eval - Editorial - Proper rustdoc summary/synopsis line by making use of extra paragraphs: Leads to better rendered output on module pages, in search result lists and overall, too - Use rustdoc warning blocks for admonitions of the form "do not call / avoid calling this query directly" - Use intra-doc links of the form ``[`Self::$query`]`` to cross-link queries. Indeed, such links are generally a bit brittle due to the existence of `TyCtxtFeed` which only contains a subset of queries. Therefore the docs of `feedable` queries cannot cross-link to non-`feedable` ones. I'd say it's fine to use intra-doc links despite the potential/unlikely occasional future breakage (if a query with the aforementioned characteristics becomes `feedable`). `Self::` is nicer than `TyCtxt::` (which would be more stable) since it accounts for other contexts like `TyCtxt{Feed,At,Ensure{,WithValue}}` - Informative - Generally add, flesh out and correct some doc comments - Add *Panic* sections (to a few selected queries only). The lists of panics aren't necessarily exhaustive and focus on the more "obvious" or "important" panics. - Where applicable add a paragraph calling attention to the relevant [`#[rustc_*]` TEST attribute](https://rustc-dev-guide.rust-lang.org/compiler-debugging.html#rustc_-test-attributes) The one non-doc change (it's internal and not observable): Be even more defensive in `query constness`'s impl (spiritual follow-up to rust-lang#134122) (see self review comment). Fixes rust-lang#133494. r\? **any**(compiler-errors, oli-obk)
poliorcetics
pushed a commit
to poliorcetics/rust
that referenced
this issue
Dec 28, 2024
…er-errors Spruce up the docs of several queries related to the type/trait system and const eval - Editorial - Proper rustdoc summary/synopsis line by making use of extra paragraphs: Leads to better rendered output on module pages, in search result lists and overall, too - Use rustdoc warning blocks for admonitions of the form "do not call / avoid calling this query directly" - Use intra-doc links of the form ``[`Self::$query`]`` to cross-link queries. Indeed, such links are generally a bit brittle due to the existence of `TyCtxtFeed` which only contains a subset of queries. Therefore the docs of `feedable` queries cannot cross-link to non-`feedable` ones. I'd say it's fine to use intra-doc links despite the potential/unlikely occasional future breakage (if a query with the aforementioned characteristics becomes `feedable`). `Self::` is nicer than `TyCtxt::` (which would be more stable) since it accounts for other contexts like `TyCtxt{Feed,At,Ensure{,WithValue}}` - Informative - Generally add, flesh out and correct some doc comments - Add *Panic* sections (to a few selected queries only). The lists of panics aren't necessarily exhaustive and focus on the more "obvious" or "important" panics. - Where applicable add a paragraph calling attention to the relevant [`#[rustc_*]` TEST attribute](https://rustc-dev-guide.rust-lang.org/compiler-debugging.html#rustc_-test-attributes) The one non-doc change (it's internal and not observable): Be even more defensive in `query constness`'s impl (spiritual follow-up to rust-lang#134122) (see self review comment). Fixes rust-lang#133494. r\? **any**(compiler-errors, oli-obk)
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
A-variance
Area: Variance (https://doc.rust-lang.org/nomicon/subtyping.html)
T-compiler
Relevant to the compiler team, which will review and decide on the PR/issue.
Location
https://doc.rust-lang.org/beta/nightly-rustc/rustc_middle/ty/struct.TyCtxt.html#method.variances_of
Summary
This method returns the variances of the generic parameters of the struct with the given def_id. Contrary to what the documentation suggests, when given the def_id of a generic parameter of a struct, it returns an empty slice.
The text was updated successfully, but these errors were encountered: