Rewritten proposal about `_::Variant`

See, personally that's not how I've been imagining this either, because then it still needs the use.

I've been thinking of this like a per-name version of Default::default(), where it doesn't care what's in-scope but does require that the type be unique from the inference context.

Like you imagine that .Foo translates as though there were a trait Foo { fn foo() -> Self; } and an impl Foo for MyEnum { fn foo() -> Self { Self::Foo } }, and you'd written <_ as Foo>::foo().

Because not having to care about the type -- don't think about it, don't put it in the use, etc -- seems like the point of this feature to me. Once you've used the type name, you could have just used the variants or given it a nice short name.

2 Likes