Skip to content
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

#[pinned_drop] is a silent no-op if (PinnedDrop) isn't added to #[pin_project] #179

Closed
sfackler opened this issue Jan 23, 2020 · 2 comments · Fixed by #180
Closed

#[pinned_drop] is a silent no-op if (PinnedDrop) isn't added to #[pin_project] #179

sfackler opened this issue Jan 23, 2020 · 2 comments · Fixed by #180
Labels
A-drop Area: #[pinned_drop] and Drop C-bug Category: related to a bug.

Comments

@sfackler
Copy link

If you take the #[pinned_drop] example and remove the argument to #[pin_project], it compiles without warnings but doesn't actually run the PinnedDrop impl when dropping: https://play.rust-lang.org/?version=stable&mode=debug&edition=2018&gist=a156327aa5ce88e290d1038cdff9df12

It'd be nice if that somehow caused a compilation error!

@taiki-e taiki-e added A-drop Area: #[pinned_drop] and Drop C-bug Category: related to a bug. C-enhancement Category: A new feature or an improvement for an existing one labels Jan 25, 2020
bors bot added a commit that referenced this issue Jan 27, 2020
180: Ensure that users cannot implement `PinnedDrop` without proper attr r=taiki-e a=Aaron1011

Fixes #179

Previously, it was possible to provide a `#[pinned_drop]` implementation
without annotating the pin-projected type with
`#[pin_project(PinnedDrop)]`. This would result in the `PinnedDrop` impl
never being used, without any warnings or errors being emitted to the
user.

This commit makes us generate a dummy `PinnedDrop` impl if the user does
not pass `PinnedDrop` as an argument to `#[pin_project]`. This dummy
impl will conflict with any user-provided impl, ensuring that the user
cannot accidentally a non-functional `PinnedDrop` impl.

Co-authored-by: Aaron Hill <aa1ronham@gmail.com>
@bors bors bot closed this as completed in 6d2b80c Jan 27, 2020
@taiki-e
Copy link
Owner

taiki-e commented Jan 27, 2020

Published 0.4.8 which fixes this issue.

@sfackler
Copy link
Author

Thanks!

@taiki-e taiki-e removed the C-enhancement Category: A new feature or an improvement for an existing one label Jan 29, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
A-drop Area: #[pinned_drop] and Drop C-bug Category: related to a bug.
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants