Pre-RFC: "Anonymous" associated types

My immediate knee-jerk reaction is:

  • "the type name must be somehow generated" comes up in a lot of other macros, and I'm pretty sure we actually need a way to generate a guaranteed-unique name for things. I'm not sure there's any interesting design discussion here beyond bikeshedding the name of the function proc macros will call to get their unique name.

  • There have been other proposals for "anonymous" structs/enums that were not specific to associated types. If we do introduce anonymous whatevers, they should probably have the same syntax and semantics as associated types as they do everywhere else.


I've noticed a common issue with these suggestions is only specifying some of the syntax. For instance, what would a value of your anonymous struct/enum types look like?

I believe past proposals usually used syntax kinda like (A | B) for anonymous enum types and values, while you're using the standard enum syntax with the name omitted. Your syntax is arguably more consistent and self-evident but probably cumbersome when you need to specify values of that anonymous type.