Join GitHub today
GitHub is home to over 28 million developers working together to host and review code, manage projects, and build software together.
Sign upFunction-like procedural macros in expression position as seen in 1.30 announcement are not stable yet #285
Comments
This comment has been minimized.
This comment has been minimized.
|
Whoops! Any ideas on a decent example we could change it to? |
This comment has been minimized.
This comment has been minimized.
coder543
commented
Oct 25, 2018
|
Will this be stabilized for 1.31? Or is there an issue to track the status of proc macros in expression position? |
This comment has been minimized.
This comment has been minimized.
|
No, it's not clear when this will become stable. As the error message says, rust-lang/rust#54727 is the tracking issue. |
This comment has been minimized.
This comment has been minimized.
|
@steveklabnik the |
This comment has been minimized.
This comment has been minimized.
|
We're going to change the |
This comment has been minimized.
This comment has been minimized.
Ralith
commented
Oct 25, 2018
Something that compiles a GLSL shader program, perhaps? e.g. vulkano has some really ugly hacks to accomplish this at present. |
This comment has been minimized.
This comment has been minimized.
rukai
commented
Oct 26, 2018
|
@Ralith Not anymore! :D vulkano-rs/vulkano#1062 |
This comment has been minimized.
This comment has been minimized.
ubnt-intrepid
commented
Nov 1, 2018
|
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:
|
This comment has been minimized.
This comment has been minimized.
|
Or use https://github.com/dtolnay/proc-macro-hack which lifts both of those restrictions. |
dtolnay commentedOct 25, 2018
Only macros in statement position are stable in 1.30.
The stabilization hasn't landed in nightly yet either.
Mentioning @steveklabnik.