-
Notifications
You must be signed in to change notification settings - Fork 1.8k
Implement bulitin line! macro #2205
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
Conversation
|
||
assert_eq!(quoted.to_string(), "impl Clone for Foo {fn clone (& self) -> Self {Self {name : self . name . clone () , id : self . id . clone () ,}}}"); | ||
} | ||
} |
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.
Neat!
I am not sure if the amount of build-in macros really requires us to have quasy-quoting, but it definitely is wort to try!
I'd also would-like to have strongly-typed quasy-quoting for assists some day...
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.
If I remember correctly, we would like to expand builtin derive as normal macro expansion. A quasy quoting macro should help there. (Thats why I use Clone
as a test case )
341ec79
to
4f7df2a
Compare
bors r+ Thanks! |
2205: Implement bulitin line! macro r=matklad a=edwin0cheng This PR implements bulitin macro `line!` and add basic infra-structure for other bulitin macros: 1. Extend `MacroDefId` to support builtin macros 2. Add a `quote!` macro for simple quasi quoting. Note that for support others builtin macros, eager macro expansion have to be supported first, this PR not try to handle it. :) Co-authored-by: Edwin Cheng <[email protected]>
Build succeeded |
This PR implements bulitin macro
line!
and add basic infra-structure for other bulitin macros:MacroDefId
to support builtin macrosquote!
macro for simple quasi quoting.Note that for support others builtin macros, eager macro expansion have to be supported first, this PR not try to handle it. :)