-
-
Notifications
You must be signed in to change notification settings - Fork 311
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
Is there a way to use syn with stable Rust? #38
Comments
Syn itself compiles fine on stable, in fact serde_codegen depends on it on stable. Here is the relevant code.
There are a few missing pieces before it can be used without syntex but I have been making steady progress on those and expect to have it ready in the next week or two. The biggest blocker was being able to parse the full Rust syntax other than just structs and enums. That is largely done, for example this 6000 line file copied from the rustc source code can be parsed and printed back such that the original and the printed one are parsed identically by syntex. If you have time to help out, the remaining missing pieces in order of importance are:
The pretty-printer is because debugging will be much easier if your build.rs produces formatted code rather than a single massive line. I don't want to be in the business of maintaining a pretty printer myself, so we need to use a dependency on an existing one that can be disabled once things work. |
I implemented the biggest missing piece in #55. I will try to make it through the remaining items quickly. let mut registry = Registry::new();
registry.add_derive("Serialize", expand_serialize);
registry.add_derive("Deserialize", expand_deserialize);
registry.expand_file(src, dst).unwrap();
fn expand_serialize(input: MacroInput) -> Result<Expanded, String> { /* ... */ }
fn expand_deserialize(input: MacroInput) -> Result<Expanded, String> { /* ... */ } |
All the pieces have been implemented. I need to write documentation and example code and cut a release. |
This is just fantastic! I have a couple of crates that will benefit from this. |
I released 0.10.0 with a custom-derive registry that is able to expand custom derives on stable Rust. |
This is a great library!
With
syntex
, it was possible to support stable Rust viabuild.rs
and source-code processing. Is there a way to do that withsyn
?The text was updated successfully, but these errors were encountered: