-
Notifications
You must be signed in to change notification settings - Fork 13.3k
Adding a PhantomData example. #22945
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
Conversation
Thanks for the pull request, and welcome! The Rust team is excited to review your changes, and you should hear from @steveklabnik (or someone else) soon. If any changes to this PR are deemed necessary, please add them as extra commits. This ensures that the reviewer can see what has changed since they last reviewed the code. The way Github handles out-of-date commits, this should also make it reasonably obvious what issues have or haven't been addressed. Large or tricky changes may require several passes of review and changes. Please see CONTRIBUTING.md for more information. |
@@ -351,7 +351,35 @@ pub trait PhantomFn<A:?Sized,R:?Sized=()> { } | |||
/// instance, it will behave *as if* an instance of the type `T` were | |||
/// present for the purpose of various automatic analyses. | |||
/// | |||
/// For example, embedding a `PhantomData<T>` will inform the compiler | |||
/// # Example |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
We use 'Examples' for everything, even if there's just one. And, there needs to be a newline after it as well.
Hey @golddranks , thank you for the PR! I have a few nits, but I'm happy with this overall. @nikomatsakis , what do you think? |
@bors rollup |
This doesn't pass doctests http://buildbot.rust-lang.org/builders/auto-mac-32-opt/builds/3982/steps/test/logs/stdio Could you ensure that |
@bors: r- |
…abnik I had to fix up some PRs: * rust-lang#22976 * rust-lang#22945 * rust-lang#22845
☔ The latest upstream changes (presumably #23179) made this pull request unmergeable. Please resolve the merge conflicts. |
Said this on IRC: Closing this :) |
There was a FIXME in the PhantomData documentation, demanding more/better examples. I have recently used PhantomData this way, so I thought this could maybe do as an example.
r? @steveklabnik