-
-
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
Move most of the processing to proc-macro-derive #135
Merged
Merged
Conversation
This file contains 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
taiki-e
added
the
C-enhancement
Category: A new feature or an improvement for an existing one
label
Oct 13, 2019
taiki-e
force-pushed
the
internal-derive
branch
2 times, most recently
from
October 14, 2019 07:18
b183603
to
ea9323a
Compare
taiki-e
changed the title
Move all of the field-dependent processing to proc-macro-derive
Move most of the processing to proc-macro-derive
Oct 14, 2019
taiki-e
force-pushed
the
internal-derive
branch
from
October 14, 2019 07:26
ea9323a
to
8869922
Compare
taiki-e
commented
Oct 14, 2019
Ok(quote! { | ||
#(#attrs)* | ||
#body | ||
}) | ||
} | ||
|
||
#[allow(dead_code)] // https://github.com/rust-lang/rust/issues/56750 |
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.
It seems to have been fixed in the latest nightly, but it is left for compatibility with other versions.
taiki-e
force-pushed
the
internal-derive
branch
from
October 14, 2019 09:00
8869922
to
991c416
Compare
By moving most of the remaining processing to proc-macro-derive, we don't have to parse AST with proc-macro-attribute, so we can improve compile time.
taiki-e
force-pushed
the
internal-derive
branch
from
October 14, 2019 09:21
991c416
to
b1bdd9a
Compare
bors r+ |
bors bot
added a commit
that referenced
this pull request
Oct 14, 2019
135: Move most of the processing to proc-macro-derive r=taiki-e a=taiki-e To generate the correct `Unpin` implementation and the projection methods, we need to collect the types of the pinned fields. However, since proc-macro-attribute is applied before `#[cfg]` and `#[cfg_attr]` on fields, we cannot be collecting field types properly at this timing. So instead of generating the `Unpin` implementation and the projection methods here, delegate their processing to proc-macro-derive. #77 moved only the automatic generation of `Unpin` implementation to proc-macro-derive but found that it could not support `#[cfg_attr]`, so this moves more processing. See also #68 (comment). This also adds support for the use of `#[cfg]` on tuple structs and tuple variants. Closes #123 Co-authored-by: Taiki Endo <te316e89@gmail.com>
Build succeeded
|
taiki-e
added
relnotes
and removed
C-enhancement
Category: A new feature or an improvement for an existing one
labels
Jan 6, 2021
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.
To generate the correct
Unpin
implementation and the projection methods, we need to collect the types of the pinned fields. However, since proc-macro-attribute is applied before#[cfg]
and#[cfg_attr]
on fields, we cannot be collecting field types properly at this timing. So instead of generating theUnpin
implementation and the projection methods here, delegate their processing to proc-macro-derive.#77 moved only the automatic generation of
Unpin
implementation to proc-macro-derive but found that it could not support#[cfg_attr]
, so this moves more processing.See also #68 (comment).
This also adds support for the use of
#[cfg]
on tuple structs and tuple variants.Closes #123