Skip to content

Commit 8cacc4a

Browse files
committed
tests: ui: compile-fail: pin_data: no_pin_on_phantompinned: fix warning
The `#[pin_data]` macro checks for fields with the type `PhantomPinned` and then emits an error if it's not marked with `#[pin]`. This check replaces the originally typed path with `::core::marker::PhantomPinned` and thus any imports of the `PhantomPinned` stuff are not used. Opened an issue: #51 Signed-off-by: Benno Lossin <benno.lossin@proton.me>
1 parent 2813729 commit 8cacc4a

File tree

2 files changed

+1
-9
lines changed

2 files changed

+1
-9
lines changed

tests/ui/compile-fail/pin_data/no_pin_on_phantompinned.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
use pin_init::*;
2-
use std::marker::{self, PhantomPinned};
2+
// use std::marker::{self, PhantomPinned};
33

44
#[pin_data]
55
struct Foo {

tests/ui/compile-fail/pin_data/no_pin_on_phantompinned.stderr

Lines changed: 0 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -29,11 +29,3 @@ error: The field `pin4` of type `PhantomPinned` only has an effect, if it has th
2929
| ^^^^^^^^^^^
3030
|
3131
= note: this error originates in the macro `$crate::__pin_data` which comes from the expansion of the attribute macro `pin_data` (in Nightly builds, run with -Z macro-backtrace for more info)
32-
33-
warning: unused imports: `PhantomPinned` and `self`
34-
--> tests/ui/compile-fail/pin_data/no_pin_on_phantompinned.rs:2:19
35-
|
36-
2 | use std::marker::{self, PhantomPinned};
37-
| ^^^^ ^^^^^^^^^^^^^
38-
|
39-
= note: `#[warn(unused_imports)]` on by default

0 commit comments

Comments
 (0)