-
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: Provide information on Send/Sync/Sized, variance, pointer indirection, ... #41537
Comments
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
There are some properties of types that are part of the "publicly visible interface" in the sense that they can be observed by other crates using these types, but they are not shown by rustdoc and usually can only be figured out by hunting through the implementation source code (potentially through many layers).
This is includes the information of when the type satisfies
Send
orSync
("when" in the sense of "which bounds are needed onT
to makeFoo<T>
beSend
), when it is sized, what is the variance of lifetime and/or type parameters, and whether type parameters are occurring exclusively below a pointer indirection. (The latter is relevant to know whetherstruct Foo { f: T<Foo> }
is legal.)I recently hit this when I wanted to figure out when exactly
MutexGuard
,RwLockReadGuard
andRwLockWriteGuard
areSend
orSync
-- I started chasing the source code, but actually it turns out to be much easier to "probe" these types by writing little programs that test whether the bounds are satisfied. Needless to say, that's not great. Ideally, rustdoc should present this information somewhere.The text was updated successfully, but these errors were encountered: