-
-
Notifications
You must be signed in to change notification settings - Fork 33
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
Implement project_replace
method.
#194
Conversation
932b151
to
1db85fa
Compare
Thanks for the PR! Could you add documentation? |
Done 👍 |
353066e
to
760cfc3
Compare
760cfc3
to
62a297e
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM aside from a few nits.
let proj_ty_generics = self.proj.generics.split_for_impl().1; | ||
let (impl_generics, ty_generics, where_clause) = self.orig.generics.split_for_impl(); | ||
|
||
let replace_impl = self.replace.map(|replace| { | ||
quote_spanned! { replace => | ||
#[allow(unsafe_code)] |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
#[allow(unsafe_code)] |
#[deny(unsafe_code)]
does not deny unsafe code generated by macros (rust-lang/rust#53975)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Hm, I only added this because it failed the test suite without it, so it doesn't appear like that behaviour is working correctly.
@taiki-e I've added the workaround for the compiler bug. I didn't remove the |
Ok! I will look into the span issues after merging this PR. |
bors r+ |
Hmm... bors seems to be crashed, I'll merge via the merge button. |
Published in 0.4.10. |
212: Add test for project_replace on panic r=taiki-e a=taiki-e Refs: * rust-lang/rust#47949 * #194 (comment) Co-authored-by: Taiki Endo <te316e89@gmail.com>
I implemented this as an opt-in method, via
#[pin_project(Replace)]
because it requiresSelf: Sized
, and because I thought it would be safest to disallow using in combination withPinnedDrop
(as it would effectively bypass thePinnedDrop
implementation).Closes #184