Assert lack of Drop impl without implementing Drop#48
Merged
bors[bot] merged 2 commits intotaiki-e:masterfrom Aug 23, 2019
Merged
Assert lack of Drop impl without implementing Drop#48bors[bot] merged 2 commits intotaiki-e:masterfrom
bors[bot] merged 2 commits intotaiki-e:masterfrom
Conversation
Previously, we would provide an empty Drop impl for types that did not provide a pinned_drop method, in order to assert that the user was not providing their own Drop impl. However, the compiler places certain restrictions on types that implement Drop. For example, you cannot move out of the fields of such types, as that would cause the Drop impl to observe the fields in an uninitialized state. This commit changes to a purely trait-based approach, as used in the assert-impl crate by @upsuper . This prevents the creation of unnecessary Drop impls, while still ensuring that the user cannot provide their own Drop impl without going through pinned_drop
Owner
|
Looks great to me. Could you update the documents as well? pin-project/pin-project-internal/src/lib.rs Lines 144 to 145 in 44426ae |
Owner
|
r=me with documents updated bors delegate+ |
Contributor
|
✌️ Aaron1011 can now approve this pull request |
Collaborator
Author
|
@taiki-e: I updated the first doc comment. I believe the second one is still accurate, as we still generate a |
96d486f to
deea6e8
Compare
Owner
|
Ah, indeed. |
Owner
|
bors r+ |
bors bot
added a commit
that referenced
this pull request
Aug 23, 2019
46: Add impl block support to #[project] attribute r=taiki-e a=taiki-e
This adds a feature to convert an annotated impl to a projected type's impl.
Example:
```rust
#[project]
impl<T, U> Foo<T, U> {
fn baz(self) {
let Self { future, field } = self;
}
}
// convert to:
impl<'_pin, T, U> __FooProjection<'_pin, T, U> {
fn baz(self) {
let Self { future, field } = self;
}
}
```
Closes #43
cc @Nemo157
48: Assert lack of Drop impl without implementing Drop r=taiki-e a=Aaron1011
Previously, we would provide an empty Drop impl for types that did not
provide a pinned_drop method, in order to assert that the user was not
providing their own Drop impl.
However, the compiler places certain restrictions on types that
implement Drop. For example, you cannot move out of the fields of such
types, as that would cause the Drop impl to observe the fields in an
uninitialized state.
This commit changes to a purely trait-based approach, as used in
the assert-impl crate by @upsuper . This prevents the creation of
unnecessary Drop impls, while still ensuring that the user cannot
provide their own Drop impl without going through pinned_drop
Co-authored-by: Taiki Endo <te316e89@gmail.com>
Co-authored-by: Aaron Hill <aa1ronham@gmail.com>
Contributor
Build succeeded
|
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Previously, we would provide an empty Drop impl for types that did not
provide a pinned_drop method, in order to assert that the user was not
providing their own Drop impl.
However, the compiler places certain restrictions on types that
implement Drop. For example, you cannot move out of the fields of such
types, as that would cause the Drop impl to observe the fields in an
uninitialized state.
This commit changes to a purely trait-based approach, as used in
the assert-impl crate by @upsuper . This prevents the creation of
unnecessary Drop impls, while still ensuring that the user cannot
provide their own Drop impl without going through pinned_drop