Closed kvark closed 5 years ago
I haven't even the slightest clue as to how to do it with rust's macros. Are you sure it's possible?
@eugene2k I don't think that you can do it with simple macro_rules!
, but it should be easy with procedural macros / compiler plugins, we might need those for other features as well. I lost track of what is happening in that area, a new macro API should step in someday and make procedural macros a lot more attractive ?
Currently "Macros 2.0" is far from being stabilized and there's also work on the "Macros 1.1" api, which AFAIK only works for #[derive()]
attributes. In other words, I don't think this bug is possible to resolve unless some sort of compiler/translator is added to gfx ecosystem to translate from DSL and into rust. Such a tool would probably solve other problems with current PSO definitions.
I was wondering if something like an artificial match
through these names in the macro-generated code would force Rust to ensure the arms (= names) are unique, even if the match result will be unused.
The error in that case would be "unreachable pattern", which would probably be very confusing.
not happened in pre-ll
Something like this shouldn't be legal:
cc @Bastacyclop @jaredr