@@ -24,7 +24,7 @@ We do this using `PhantomData`, which is a special marker type. `PhantomData`
24
24
consumes no space, but simulates a field of the given type for the purpose of
25
25
static analysis. This was deemed to be less error-prone than explicitly telling
26
26
the type-system the kind of variance that you want, while also providing other
27
- useful things such as the information needed by drop check.
27
+ useful things such as auto traits and the information needed by drop check.
28
28
29
29
Iter logically contains a bunch of ` &'a T ` s, so this is exactly what we tell
30
30
the ` PhantomData ` to simulate:
@@ -234,14 +234,14 @@ standard library made a utility for itself called `Unique<T>` which:
234
234
235
235
Here’s a table of all the wonderful ways ` PhantomData ` could be used:
236
236
237
- | Phantom type | ` 'a ` | ` T ` |
238
- | -----------------------------| -----------| ---------------------------|
239
- | ` PhantomData<T> ` | - | covariant (with drop check) |
240
- | ` PhantomData<&'a T> ` | covariant | covariant |
241
- | ` PhantomData<&'a mut T> ` | covariant | invariant |
242
- | ` PhantomData<*const T> ` | - | covariant |
243
- | ` PhantomData<*mut T> ` | - | invariant |
244
- | ` PhantomData<fn(T)> ` | - | contravariant |
245
- | ` PhantomData<fn() -> T> ` | - | covariant |
246
- | ` PhantomData<fn(T) -> T> ` | - | invariant |
247
- | ` PhantomData<Cell<&'a ()>> ` | invariant | - |
237
+ | Phantom type | ` 'a ` | ` T ` | ` Send ` | ` Sync ` |
238
+ | -----------------------------| -----------| ----------------------------- | ----------- | ----------- |
239
+ | ` PhantomData<T> ` | - | covariant (with drop check) | ` T: Send ` | ` T: Sync ` |
240
+ | ` PhantomData<&'a T> ` | covariant | covariant | ` T: Sync ` | ` T: Sync ` |
241
+ | ` PhantomData<&'a mut T> ` | covariant | invariant | ` T: Send ` | ` T: Sync ` |
242
+ | ` PhantomData<*const T> ` | - | covariant | - | - |
243
+ | ` PhantomData<*mut T> ` | - | invariant | - | - |
244
+ | ` PhantomData<fn(T)> ` | - | contravariant | ` Send ` | ` Sync ` |
245
+ | ` PhantomData<fn() -> T> ` | - | covariant | ` Send ` | ` Sync ` |
246
+ | ` PhantomData<fn(T) -> T> ` | - | invariant | ` Send ` | ` Sync ` |
247
+ | ` PhantomData<Cell<&'a ()>> ` | invariant | - | ` Send ` | - |
0 commit comments