Skip to content
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

Closed
RalfJung opened this issue Apr 25, 2017 · 5 comments

Comments

@RalfJung
Copy link
Member

RalfJung commented Apr 25, 2017

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 or Sync ("when" in the sense of "which bounds are needed on T to make Foo<T> be Send), 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 whether struct Foo { f: T<Foo> } is legal.)

I recently hit this when I wanted to figure out when exactly MutexGuard, RwLockReadGuard and RwLockWriteGuard are Send or Sync -- 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.

@QuietMisdreavus
Copy link
Member

Possibly a duplicate of #33772?

@ollie27
Copy link
Member

ollie27 commented Apr 25, 2017

I'd say this is a dupe of #17606.

@Mark-Simulacrum
Copy link
Member

Closing in favor of #17606. #33772 is similar (and perhaps a duplicate of #17606), but I think that #17606 is closer to what this specific issue is asking for.

@SOF3
Copy link
Contributor

SOF3 commented Oct 15, 2023

It seems the mentioned issues only track marker traits. Is the "variance" part duplicated anywhere or shall I create a new issue?

@RalfJung
Copy link
Member Author

I'm not aware of one, so feel free to open one. :)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

5 participants