-
Notifications
You must be signed in to change notification settings - Fork 13k
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
Rustdoc renders Vec's new allocator type parameter even when set to the default #80379
Comments
This is a bug at least back to 1.22.0. |
In the inner crate, the params never get passes to
but in the outer one they do show up:
I expect this has to do with some difference between HIR and metadata loading. |
The issue is that metadata types, unlike HIR types, go through rust/src/librustdoc/clean/mod.rs Line 1584 in 89524d0
and external_path doesn't pay any attention to the type defaults: rust/src/librustdoc/clean/utils.rs Line 103 in 89524d0
So rustdoc needs to know which of the generic arguments were added by the user and which are just defaults. |
Cleanup rustdoc handling of associated types This is best reviewed a commit at a time. No particular reason for these changes, they just stood out as I was reviewing rust-lang#80653 and thinking about rust-lang#80379. The new test case worked before, it just wasn't tested. r? `@GuillaumeGomez`
I came across another instance of this recently (#89712), but with a twist. The type that was re-exported also contained a type alias, which was expanded in the re-exported version. Is that the same bug or slightly different? |
@rustbot claim |
I suspect they're both caused by using metadata loading instead of HIR, if that's what you're asking, but the fix for the two will likely look different. |
…r-obj-lt-bnds, r=notriddle,cgillot,GuillaumeGomez rustdoc: re-elide cross-crate default trait-object lifetime bounds Hide trait-object lifetime bounds (re-exported from an external crate) if they coincide with [their default](https://doc.rust-lang.org/reference/lifetime-elision.html#default-trait-object-lifetimes). Partially addresses rust-lang#44306. Follow-up to rust-lang#103885. [Zulip discussion](https://rust-lang.zulipchat.com/#narrow/stream/266220-rustdoc/topic/clean_middle_ty.3A.20I.20need.20to.20add.20a.20parameter/near/307143097). Most notably, if `std` exported something from `core` containing a type like `Box<dyn Fn()>`, then it would now be rendered as `Box<dyn Fn(), Global>` instead of `Box<dyn Fn() + 'static, Global>` (hiding `+ 'static` as it is the default in this case). Showing `Global` here is a separate issue, rust-lang#80379, which is on my agenda. Note that I am not really fond of the fact that I had to add a parameter to such a widely used function (30+ call sites) to address such a niche bug. CC `@GuillaumeGomez` Requesting a review from a compiler contributor or team member as recommended on Zulip. r? compiler --- `@rustbot` label T-compiler T-rustdoc A-cross-crate-reexports
…-args, r=<try> rustdoc: elide cross-crate default generic arguments Early draft. Requesting perf run. Thx :) CC `@GuillaumeGomez` Elide cross-crate generic arguments if they coincide with their default. TL;DR: Most notably, no more `Box<…, Global>` in `std`'s docs, just `Box<…>` from now on. Fixes rust-lang#80379. Also helps with rust-lang#44306. Follow-up to rust-lang#103885,rust-lang#107637. `@rustbot` label T-rustdoc A-cross-crate-reexports S-experimental r? `@ghost`
…-args, r=<try> rustdoc: elide cross-crate default generic arguments Elide cross-crate generic arguments if they coincide with their default. TL;DR: Most notably, no more `Box<…, Global>` in `std`'s docs, just `Box<…>` from now on. Fixes rust-lang#80379. Also helps with rust-lang#44306. Follow-up to rust-lang#103885, rust-lang#107637. r? `@ghost`
…-args, r=<try> rustdoc: elide cross-crate default generic arguments Elide cross-crate generic arguments if they coincide with their default. TL;DR: Most notably, no more `Box<…, Global>` in `std`'s docs, just `Box<…>` from now on. Fixes rust-lang#80379. Also helps with rust-lang#44306. Follow-up to rust-lang#103885, rust-lang#107637. r? `@ghost`
…en-args, r=GuillaumeGomez rustdoc: elide cross-crate default generic arguments Elide cross-crate generic arguments if they coincide with their default. TL;DR: Most notably, no more `Box<…, Global>` in `std`'s docs, just `Box<…>` from now on. Fixes rust-lang#80379. Also helps with rust-lang#44306. Follow-up to rust-lang#103885, rust-lang#107637. r? `@ghost`
Rollup merge of rust-lang#112463 - fmease:rustdoc-elide-x-crate-def-gen-args, r=GuillaumeGomez rustdoc: elide cross-crate default generic arguments Elide cross-crate generic arguments if they coincide with their default. TL;DR: Most notably, no more `Box<…, Global>` in `std`'s docs, just `Box<…>` from now on. Fixes rust-lang#80379. Also helps with rust-lang#44306. Follow-up to rust-lang#103885, rust-lang#107637. r? ``@ghost``
For example, the docs for this type use
Vec<String, Global>
rather than justVec<String>
: https://docs.rs/tokio-postgres/0.7.0/tokio_postgres/types/enum.Kind.html. The definition of the type does not specify the allocator parameter if that matters.The same is not true for e.g.
HashMap
's hasher type parameter, so I'm not sure what's different in this case.The text was updated successfully, but these errors were encountered: