-
Notifications
You must be signed in to change notification settings - Fork 205
Expose type aliases that are used in pub interfaces #1028
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
base: main
Are you sure you want to change the base?
Expose type aliases that are used in pub interfaces #1028
Conversation
Signed-off-by: Matthias Beyer <[email protected]>
This pull request sets up GitHub code scanning for this repository. Once the scans have completed and the checks have passed, the analysis results for this pull request branch will appear on this overview. Once you merge this pull request, the 'Security' tab will show more code scanning analysis results (for example, for the default branch). Depending on your configuration and choice of analysis tool, future pull requests will be annotated with code scanning analysis results. For more information about GitHub code scanning, check out the documentation. |
No it doesn't? |
Ah I use them only as shorthand myself. I believe in the public interfaces they are expanded out? At least they should... |
Well, if you don't export them, users have to dig through your sourcecode to see what the actual type is that is aliased and copy that to their function signatures. Exporting the aliases helps a lot here. |
Ah, I thought it is expanded out in the docs. I suppose you mean code editors will still show the type shorthands? |
Yes, and the aliases are also useful for the users of your library. I just wrote some setup code where my functions return |
My thinking is... it would be easy for someone to define their own shorthand types. I'm not sure the shorthands, as they are named right now, are the best names. If we open them to public, we can no longer rename them easily in the future. Therefore, we might as well spend some more time pondering alternative names before we settle on a set... Do you feel |
TBH, no. But then they should not appear in public interfaces. If I do "rust-analyzer please tell me the signature of this call" and it gives me something that's not publicly exposed, that's frustrating. I guess there might be some tooling that can be used in CI to ensure some stuff is not visible in public interfaces, but I forgot what the tool was. |
But you can press F12 to jump to the actual definition? |
These type aliases were private before.
Using them is not possible.
This patch exposes them, so users do not have to work around that limitation.