-
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
Generate documentation for auto-trait impls #47833
Merged
Merged
Commits on Feb 18, 2018
-
Generate documentation for auto-trait impls
A new section is added to both both struct and trait doc pages. On struct/enum pages, a new 'Auto Trait Implementations' section displays any synthetic implementations for auto traits. Currently, this is only done for Send and Sync. On trait pages, a new 'Auto Implementors' section displays all types which automatically implement the trait. Effectively, this is a list of all public types in the standard library. Synthesized impls for a particular auto trait ('synthetic impls') take into account generic bounds. For example, a type 'struct Foo<T>(T)' will have 'impl<T> Send for Foo<T> where T: Send' generated for it. Manual implementations of auto traits are also taken into account. If we have the following types: 'struct Foo<T>(T)' 'struct Wrapper<T>(Foo<T>)' 'unsafe impl<T> Send for Wrapper<T>' // pretend that Wrapper<T> makes this sound somehow Then Wrapper will have the following impl generated: 'impl<T> Send for Wrapper<T>' reflecting the fact that 'T: Send' need not hold for 'Wrapper<T>: Send' to hold Lifetimes, HRTBS, and projections (e.g. '<T as Iterator>::Item') are taken into account by synthetic impls However, if a type can *never* implement a particular auto trait (e.g. 'struct MyStruct<T>(*const T)'), then a negative impl will be generated (in this case, 'impl<T> !Send for MyStruct<T>') All of this means that a user should be able to copy-paste a synthetic impl into their code, without any observable changes in behavior (assuming the rest of the program remains unchanged).
Configuration menu - View commit details
-
Copy full SHA for 6728f21 - Browse repository at this point
Copy the full SHA 6728f21View commit details -
Configuration menu - View commit details
-
Copy full SHA for 9d7165f - Browse repository at this point
Copy the full SHA 9d7165fView commit details -
Configuration menu - View commit details
-
Copy full SHA for 1531fbe - Browse repository at this point
Copy the full SHA 1531fbeView commit details -
Configuration menu - View commit details
-
Copy full SHA for 0bfbe24 - Browse repository at this point
Copy the full SHA 0bfbe24View commit details -
Configuration menu - View commit details
-
Copy full SHA for 94fd4f3 - Browse repository at this point
Copy the full SHA 94fd4f3View commit details -
Configuration menu - View commit details
-
Copy full SHA for 64a1f6f - Browse repository at this point
Copy the full SHA 64a1f6fView commit details -
Configuration menu - View commit details
-
Copy full SHA for 298d703 - Browse repository at this point
Copy the full SHA 298d703View commit details -
Configuration menu - View commit details
-
Copy full SHA for 0c6ad46 - Browse repository at this point
Copy the full SHA 0c6ad46View commit details -
Configuration menu - View commit details
-
Copy full SHA for 2aead59 - Browse repository at this point
Copy the full SHA 2aead59View commit details
Commits on Feb 19, 2018
-
Configuration menu - View commit details
-
Copy full SHA for 8788179 - Browse repository at this point
Copy the full SHA 8788179View commit details
Commits on Feb 20, 2018
-
Sort synthetic impls bounds before rendering
This removes the implicit dependency on the iteration order of FxHashMap
Configuration menu - View commit details
-
Copy full SHA for 44d07df - Browse repository at this point
Copy the full SHA 44d07dfView commit details
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.