|
|
|
|
|
by hobofan
2269 days ago
|
|
It's a block though, isn't it? Color::Green is an enum variant while { Color::Green } is a (constant) block (expression) that evaluates to an instance which is used as a generic type parameter. The difference might be more easily understandable if we look at an enum variant that holds a value, where the syntactic differences between variant and instance constructor are more clearly visible. Color::RGB(u64, u64, u64) vs { Color::RGB(10, 20, 30) } |
|
> Identity expression: An expression which cannot be evaluated further except by substituting it with names in scope. This includes all literals as well all idents
So... maybe? Depends on whether Color::Green is an ident or not. At the very least I'd expect this to work, but it doesn't yet: