-
Notifications
You must be signed in to change notification settings - Fork 12.8k
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 "Aliased Type" view is wrong #120404
Comments
What crate is this for? Can you give a minimal example that reproduces this behavior? |
This works exactly as intended: The “aliased type” shown isn't a real user-written type but a synthetic one. |
Of course, we should probably employ some more heuristics and e.g., not show aliased structs whose fields are all private. |
I can understand that that feature might be a bit unintuitive at first. If you have suggestions for making it clearer to the reader that this aliased type isn't grounded in source code, please don't hesitate to share them :) |
To me, "aliased type" strictly refers to the right-hand side of the |
@SludgePhD Except that this wouldn't work in "generic context", take for exemple this type alias: type NonZeroU128 = NonZero<u128>; writting it with the "right hand side" would mean: struct NonZero<u128>(/* ... */); which is not a valid syntax and is not that what anyone that would use Taking a more expressive example: struct Container<A: Trait>(pub A, pub A);
type MyContainer = Container<MyStruct, MyStruct>; Here, the aliased type (as seen by the compiler) is: struct MyContainer(pub MyStruct, pub MyStruct); and it makes much more sense to write it like this. That way users don't have the irrelevant You can look at the description of #114855 for a more detailed explanation and motivation for the "aliased type" feature. As for how we can improve the reading of this section, what about a tooltip (or small label) with something like this:
|
In this rustdoc output, rustdoc seems to claim that
MatrixView
aliases astruct MatrixView
.This is wrong, since no such
struct
exists. It seems like there was some sort of mistake when implementing this feature that ended up using the wrong name there? It should sayMatrix
instead.The text was updated successfully, but these errors were encountered: