-
Notifications
You must be signed in to change notification settings - Fork 288
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
Function-like procedural macros in expression position as seen in 1.30 announcement are not stable yet #285
Comments
Whoops! Any ideas on a decent example we could change it to? |
Will this be stabilized for 1.31? Or is there an issue to track the status of proc macros in expression position? |
No, it's not clear when this will become stable. As the error message says, rust-lang/rust#54727 is the tracking issue. |
@steveklabnik the |
We're going to change the |
Something that compiles a GLSL shader program, perhaps? e.g. vulkano has some really ugly hacks to accomplish this at present. |
@Ralith Not anymore! :D vulkano-rs/vulkano#1062 |
I'm currently working on introducing a new helper macros in my project, based on #[proc_macro]
pub fn sql_impl(input: TokenStream) -> TokenStream {
let expr = derive_sql_expr(input);
quote::quote!(
fn output() -> impl sql::Sql {
#output
}
).into()
} extern crate sql_impl;
#[doc(hidden)]
pub use sql_impl::*;
#[macro_export(local_inner_macros)]
macro_rules! sql {
($($t:tt)*) => {{
struct __Dummy;
impl __Dummy {
sql_impl!($($t)*);
}
__Dummy::output()
}}
} Restrictions:
|
Or use https://github.com/dtolnay/proc-macro-hack which lifts both of those restrictions. |
Only macros in statement position are stable in 1.30.
The stabilization hasn't landed in nightly yet either.
Mentioning @steveklabnik.
The text was updated successfully, but these errors were encountered: