-
Notifications
You must be signed in to change notification settings - Fork 1.6k
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
Declarative macro_rules!
attribute macros
#3697
Open
joshtriplett
wants to merge
27
commits into
rust-lang:master
Choose a base branch
from
joshtriplett:declarative-attribute-macros.md
base: master
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Open
Declarative macro_rules!
attribute macros
#3697
joshtriplett
wants to merge
27
commits into
rust-lang:master
from
joshtriplett:declarative-attribute-macros.md
+222
−0
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
joshtriplett
added
the
T-lang
Relevant to the language team, which will review and decide on the RFC.
label
Sep 21, 2024
kpreid
reviewed
Sep 21, 2024
kennytm
reviewed
Sep 21, 2024
joshtriplett
added
the
I-lang-nominated
Indicates that an issue has been nominated for prioritizing at the next lang team meeting.
label
Sep 22, 2024
Nominated as a follow-up to recent lang discussions about this. |
how will this work in // ok
macro main {
attr() ($func:item) => { make_async_main!($func) },
attr(threads = $threads:literal) ($func:item) => { make_async_main!($func, $threads) },
}
// ?
macro stub attr() ($func:item) {
make_stub_func!($func)
} |
|
tgross35
reviewed
Sep 24, 2024
tgross35
reviewed
Sep 24, 2024
epage
reviewed
Sep 26, 2024
epage
reviewed
Sep 26, 2024
epage
reviewed
Sep 26, 2024
epage
reviewed
Sep 28, 2024
madsmtm
approved these changes
Sep 29, 2024
Co-authored-by: Mads Marquart <[email protected]>
Co-authored-by: Jacob Lifshay <[email protected]>
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Labels
I-lang-nominated
Indicates that an issue has been nominated for prioritizing at the next lang team meeting.
T-lang
Relevant to the language team, which will review and decide on the RFC.
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.
Many crates provide attribute macros. Today, this requires defining proc
macros, in a separate crate, typically with several additional dependencies
adding substantial compilation time, and typically guarded by a feature that
users need to remember to enable.
However, many common cases of attribute macros don't require any more power
than an ordinary
macro_rules!
macro. Supporting these common cases wouldallow many crates to avoid defining proc macros, reduce dependencies and
compilation time, and provide these macros unconditionally without requiring a
the user to enable a feature.
I've reviewed several existing proc-macro-based attributes in the ecosystem,
and it appears that many would be able to use this feature to avoid needing
proc macros at all.
Rendered