You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I can generate SampleRegisterSetEnum and SampleRegisterSetWriteRegister, but if I try to use their variants in a match arm rustc nopes out:
thread 'rustc' panicked at '`"SampleRegisterSetWriteRegister::R0"` is not a valid identifier', compiler\rustc_expand\src\proc_macro_server.rs:332:13
[...]
error: custom attribute panicked
--> src\macro_tests.rs:3:5
|
3 | #[register_set]
| ^^^^^^^^^^^^^^^
|
= help: message: `"SampleRegisterSetWriteRegister::R0"` is not a valid identifier
I have narrowed it down to my syn::Ident::new call, where I build the enum's name and variant dynamically:
I have this sample struct:
I want it to expand to:
I can generate
SampleRegisterSetEnum
andSampleRegisterSetWriteRegister
, but if I try to use their variants in a match arm rustc nopes out:I have narrowed it down to my
syn::Ident::new
call, where I build the enum's name and variant dynamically:How can I use types that are being generated in Idents? I hope it is not impossible to generate code that uses generated types?
The text was updated successfully, but these errors were encountered: