# Pre-RFC: "Anonymous" associated types

**URL:** https://internals.rust-lang.org/t/pre-rfc-anonymous-associated-types/7477
**Category:** language design
**Created:** [May 8, 2018, 7:56pm UTC](https://internals.rust-lang.org/t/pre-rfc-anonymous-associated-types/7477 "2018-05-08T19:56:11Z")
**Posts on this page:** 1
**Showing post:** 2

<div class="post-metadata">

### Author: ![Ixrec](https://sea2.discourse-cdn.com/flex002/user_avatar/internals.rust-lang.org/ixrec/32/6754_2.png) [@Ixrec](https://internals.rust-lang.org/u/Ixrec)
#### Post date: [May 8, 2018, 8:10pm UTC](https://internals.rust-lang.org/t/pre-rfc-anonymous-associated-types/7477/2 "2018-05-08T20:10:36Z")

</div>

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.

Links:

> [@\[Pre-RFC\] Anonymous enum](https://internals.rust-lang.org/t/pre-rfc-anonymous-enum/4806/2):
>
> There have been three attempts at something like this over the years that have a lot of interesting discussion attached:
> 
> [RFC: Anonymous enum types called joins, as `A | B` by reem · Pull Request #402 · rust-lang/rfcs · GitHub](https://github.com/rust-lang/rfcs/pull/402)[Anonymous enum types (A|B) take 2 by scialex · Pull Request #514 · rust-lang/rfcs · GitHub](https://github.com/rust-lang/rfcs/pull/514)[https://github.com/rust-lang/rfcs/pull/1154](https://github.com/rust-lang/rfcs/pull/1154)

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.

---

_[View the full topic](https://internals.rust-lang.org/t/pre-rfc-anonymous-associated-types/7477)._
