Repository navigation
rustdoc: "Methods from Deref<...>" too low on sidebar #85618
Description
Activity
- addedT-rustdocRelevant to the rustdoc team, which will review and decide on the PR/issue.Relevant to the rustdoc team, which will review and decide on the PR/issue.regression-from-stable-to-betaPerformance or correctness regression from stable to beta.Performance or correctness regression from stable to beta.C-bugCategory: This is a bug.Category: This is a bug.A-rustdoc-uiArea: Rustdoc UI (generated HTML)Area: Rustdoc UI (generated HTML)
on May 24, 2021 - addedI-prioritizeIssue needs a team member to assess the impact. Will be replaced by P-{low,medium,high,critical}Issue needs a team member to assess the impact. Will be replaced by P-{low,medium,high,critical}
on May 24, 2021 Ah, looks like this was intentional in #83826, after conversation in #83133. Removing C-bug and regression-from-stable-to-beta. Keeping this open as a discussion issue: I think putting "Methods from Deref" further down than trait implementations is wrong for String, because so many of its important methods are on
str. I'd like to either reconsider #83133 or find some way to make this work nicely for String. Vec is probably in the same boat, with itsimpl Deref<Target = [T]>.- removedC-bugCategory: This is a bug.Category: This is a bug.I-prioritizeIssue needs a team member to assess the impact. Will be replaced by P-{low,medium,high,critical}Issue needs a team member to assess the impact. Will be replaced by P-{low,medium,high,critical}regression-from-stable-to-betaPerformance or correctness regression from stable to beta.Performance or correctness regression from stable to beta.
on May 24, 2021 I'd like to voice that I also think this is a kind of regression. 99% of the time I go to a type's page, I'm looking for methods, not traits; I've gotten used to seeing
str's methods directly underStrings, and it feels like a mistake moving away from this.Reacted by Jacob Hoffman-Andrews@jyn514, @slightlyoutofphase, what do you think of reverting #83826 while we look for a better solution. From #83133:
it would almost certainly be better to have the crate-native "Trait Implementations" section appear before the "Methods From Deref" section does, since "Trait Implementations" will pretty much always be describing things that are unique to the crate being documented and so actually directly relevant
The problem with this is sometimes the "Methods from Deref" section refers to a type in the crate. Particularly for Vec and String, about half of the most useful methods are on
[T]andstr, respectively.Those are types that are a critical part of the new user learning path, and it's a good user experience for those to be right next to the other methods, both in the sidebar and in the doc.
I suspect there are other ways to solve the need expressed in #83133 without affecting the page layout of Vec and String in this way.
- added a commit that references this issue
on Jun 23, 2021 slightlyoutofphase commented
on Dec 23, 2021 ContributorMore actionsI suspect there are other ways to solve the need expressed in #83133 without affecting the page layout of Vec and String in this way.
FWIW, I originally opened that issue with something more like a directly configurable way of specifying the page layout order for your own crate in mind. I still think that would ultimately be the best solution here. Unsure what the best approach would be, though, as far as top level attribute vs. command-line flag vs. any other way of doing it.
Other stuff like what is and isn't "collapsed" by default should probably be configurable also, I'd say.
Steps to reproduce:
Expected result:
Methods from Deref section comes immediately after Methods.
Actual result:
Methods from Deref section comes below Trait Implementations, Auto Trait Implementations, and Blanket Implementations.
Compare vs https://doc.rust-lang.org/std/string/struct.String.html, which has the correct ordering.