ghost icon indicating copy to clipboard operation
ghost copied to clipboard

Support phantom void enum

Open L-as opened this issue 6 years ago • 3 comments

Title.

L-as avatar Jan 23 '19 13:01 L-as

I'm not sure what you mean. Could you give an example of the enum use case you have in mind?

dtolnay avatar Jan 23 '19 19:01 dtolnay

Sorry for late reply, here's an example:

enum MyEnum<T> {}

Today this won't work since T isn't used. You can't use PhantomData here as easily, since you'd need to create a variant, which you don't want.

L-as avatar Jan 27 '19 19:01 L-as

It is not currently implemented but the same technique would work. I would be prepared to consider a PR adding support for zero-variant enums.

dtolnay avatar Jan 27 '19 19:01 dtolnay

Upon revisiting this, I think I'll leave this functionality to a different crate.

dtolnay avatar Jul 03 '23 21:07 dtolnay