-
Notifications
You must be signed in to change notification settings - Fork 321
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
Marker attributes #261
Marker attributes #261
Conversation
Agree ;)
Why do we add dependency on syn? Since the proc macro itself does nothing in it, what about implementing a "raw" proc macro? |
What about this: let the |
It's needed to remove the attributes from the AST, as rustc does not accept attribute macros on fields. (Only derive macros are allowed to have field attributes.) |
Also yes, the macro does little to no work if it's not used on a struct/enum/union. |
Hmm interesting... Can we do it without syn dependency? |
I've never tried this, it does seem a lot more effort upfront though. What we could do is re-implement a subset of syn's features, but of course we'd still be depending on the parsing functionality of syn which is only a fraction of the code. |
Interesting... Then we should not do that.
Then this becomes a question |
Related: rust-lang/rust#65823 |
Given that this is a new feature with no real use cases yet, I think we can keep it gated behind a feature for now (already done), and we can reassess this need later on. |
btw is there a crate that we can use directly, instead of manually writing down those calls to remove_marker_attr? seems like this should be a commonly used situation |
going to merge it and publish it and change CI soon |
FWIW the last commit shaved off about 2 seconds on a debug clean build, so I'm hopeful it's not too much of an impact. |
I'm quite sure frb_codegen has no use for these, as they are only there to satisfy rustc? Anyways I can move them later if needed. |
I mean these flutter_rust_bridge/frb_macros/src/lib.rs Lines 14 to 72 in 409acd9
is there someone already write down a crate called, e.g. "create_proc_macro_that_does_nothing" on crates.io and we can use that |
Agree. not a big problem |
Strangely enough, I couldn't find anything like that, the closest thing was wasm_bindgen itself which uses more features of syn. |
interesting. so let me merge it I may not have time immediately and will publish tomorrow (ping me if I forget) |
Resolves #260.
Only the attribute macro itself is implemented, not any mechanism to retrieve information from the attributes.
Some bike-shedding:
frb
.syn
.