-
Notifications
You must be signed in to change notification settings - Fork 13.4k
std: refactor explanation of NonNull
#141946
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: master
Are you sure you want to change the base?
Conversation
Streamlined the explanation of covariance for `NonNull<T>`, focusing on practical usage and reducing scary explanation. Added a concise example for cases where invariance is required, showing how to use `PhantomData<Cell<T>> Signed-off-by: xizheyin <[email protected]>
I've avoided big changes this time, removing some of the “scary” descriptions and replacing them with more practical advice, and adding more specific explanations for the examples. |
Hm. I know I filed the issues but I wasn't really expecting to get two PRs immediately and requested on them, I kinda expected them to hit the rotation, and this is a slightly more tricky PR to judge when biased by being the reporter. So I'm going to pass them onto the rotation, sorry! ^^; r? libs |
Failed to set assignee to
|
lol |
Fixes #141933
I cut out the excessive explanation and used an example to explain how to maintain invariance, but I think what is quoted in the rust reference in the document needs to be added with a more layman's explanation and example.
(I'm not sure if I deleted too much)
r? @workingjubilee