Add Gankro's table to nomicon/src/phantom-data.md#40069
Add Gankro's table to nomicon/src/phantom-data.md#40069bors merged 1 commit intorust-lang:masterfrom
Conversation
|
(rust_highfive has picked a reviewer for you, use r? to override) |
|
@bors: r+ neat, thank you! ❤️ |
|
📌 Commit 49fa66c has been approved by |
|
@pnkfelix Does |
|
This is what I used to test whether the drop checker is active: use std::marker::PhantomData;
struct Inspector<'a>(&'a ());
impl<'a> Drop for Inspector<'a> {
fn drop(&mut self) {}
}
fn wrap<T>(_: T) -> PhantomData<T> { PhantomData }
fn main() {
let (i, inspector);
i = ();
inspector = wrap(Inspector(&i));
}Right now this fails to compile. But if I use |
|
Nice! You said:
The code doesn't demonstrate this, did you mean the opposite? |
Yeah, I meant the opposite. The documentation is correct, but I messed up the commit message / pull request -.- Rebasing… |
Original: rust-lang#30069 (comment) Testing confirms that: - PhantomData<fn() -> T> does not actually enable drop checking. - PhantomData<fn(T) -> T> is neither variant nor contravariant.
|
@bors: r+ rollup nice catch all, sorry I missed it! 😓 |
|
📌 Commit 1f75085 has been approved by |
Add Gankro's table to nomicon/src/phantom-data.md Original: rust-lang#30069 (comment) Testing confirms that: - `PhantomData<fn() -> T>` does not actually enable drop checking. - `PhantomData<fn(T) -> T>` is neither variant nor contravariant.
|
Thanks for the clarification and the new and better docs! |
Add Gankro's table to nomicon/src/phantom-data.md Original: rust-lang#30069 (comment) Testing confirms that: - `PhantomData<fn() -> T>` does not actually enable drop checking. - `PhantomData<fn(T) -> T>` is neither variant nor contravariant.
Rollup of 28 pull requests - Successful merges: #39859, #39864, #39888, #39903, #39905, #39914, #39945, #39950, #39953, #39961, #39980, #39988, #39993, #39995, #40019, #40020, #40022, #40024, #40025, #40026, #40027, #40031, #40035, #40037, #40038, #40064, #40069, #40086 - Failed merges: #39927, #40008, #40047
Original: #30069 (comment)
Testing confirms that:
PhantomData<fn() -> T>does not actually enable drop checking.PhantomData<fn(T) -> T>is neither variant nor contravariant.