-
Notifications
You must be signed in to change notification settings - Fork 1.9k
"borrow checker invariants" section of the "leveraging the type system" chapter #2867
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: main
Are you sure you want to change the base?
"borrow checker invariants" section of the "leveraging the type system" chapter #2867
Conversation
…n to lifetime connections
Thanks for your pull request! It looks like this may be your first contribution to a Google open source project. Before we can look at your pull request, you'll need to sign a Contributor License Agreement (CLA). View this failed invocation of the CLA check for more information. For the most up to date status, view the checks section at the bottom of the pull request. |
src/idiomatic/leveraging-the-type-system/borrow-checker-invariants.md
Outdated
Show resolved
Hide resolved
src/idiomatic/leveraging-the-type-system/borrow-checker-invariants/generalizing-ownership.md
Show resolved
Hide resolved
src/idiomatic/leveraging-the-type-system/borrow-checker-invariants/generalizing-ownership.md
Outdated
Show resolved
Hide resolved
src/idiomatic/leveraging-the-type-system/borrow-checker-invariants/single-use-values.md
Outdated
Show resolved
Hide resolved
src/idiomatic/leveraging-the-type-system/borrow-checker-invariants/aliasing-xor-mutability.md
Outdated
Show resolved
Hide resolved
src/idiomatic/leveraging-the-type-system/borrow-checker-invariants/aliasing-xor-mutability.md
Outdated
Show resolved
Hide resolved
src/idiomatic/leveraging-the-type-system/borrow-checker-invariants/aliasing-xor-mutability.md
Outdated
Show resolved
Hide resolved
src/idiomatic/leveraging-the-type-system/borrow-checker-invariants.md
Outdated
Show resolved
Hide resolved
src/idiomatic/leveraging-the-type-system/borrow-checker-invariants.md
Outdated
Show resolved
Hide resolved
src/idiomatic/leveraging-the-type-system/borrow-checker-invariants/generalizing-ownership.md
Outdated
Show resolved
Hide resolved
src/idiomatic/leveraging-the-type-system/borrow-checker-invariants/generalizing-ownership.md
Outdated
Show resolved
Hide resolved
src/idiomatic/leveraging-the-type-system/borrow-checker-invariants/generalizing-ownership.md
Outdated
Show resolved
Hide resolved
src/idiomatic/leveraging-the-type-system/borrow-checker-invariants/aliasing-xor-mutability.md
Outdated
Show resolved
Hide resolved
src/idiomatic/leveraging-the-type-system/borrow-checker-invariants/lifetime-connections.md
Outdated
Show resolved
Hide resolved
src/idiomatic/leveraging-the-type-system/borrow-checker-invariants/lifetime-connections.md
Outdated
Show resolved
Hide resolved
src/idiomatic/leveraging-the-type-system/borrow-checker-invariants/lifetime-connections.md
Outdated
Show resolved
Hide resolved
src/idiomatic/leveraging-the-type-system/borrow-checker-invariants/lifetime-connections.md
Outdated
Show resolved
Hide resolved
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.
I apologize for the enormous delay here -- it's been a busy couple of months!
This looks great, and I appreciate seeing previous comments included here.
pub struct TaggedData<T> { | ||
data: String, | ||
_phantom: PhantomData<T>, | ||
} |
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.
It's unclear what purpose T
serves here, aside from illustrating PhantomData<T>
?
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.
It's largely to prevent there being a gap in understanding what PhantomData
can do. PhantomData
has not been introduced until this point, and one might imagine it is "just" for lifetimes without this nudge towards "you can put anything here."
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.
Which is to say, you're correct that it is just illustrative of the broader possible uses of PhantomData
.
Adds materials on the "leveraging the type system/borrow checker invariants" subject.
I'm still calibrating what's expected subject-and-style wise, so do spell out things where I've drifted off mark.