In short, I want to be able to do `let x = X::A(5); x[X::A];`

, where it panics (like a Vec out of range) if it’s not the correct enum variant.

I’ve tried quite a few different approaches which I won’t list here for brevity. Here is a simple example of the kind of thing I’m looking for:

```
#![feature(unboxed_closures)]
enum X {
A(u8,u8),
B(u8)
}
impl<F,T> std::ops::Index<F> for X where F: std::ops::Fn<T, Output=X> {
type Output = T;
fn index(&self, x: F) -> &T {
unimplemented!();
}
}
fn main() {
let a = X::A(10,11);
let b = X::B(12);
println!("{:?}, {:?}", a[X::A], b[X::B]);
}
```

This complains because T is unconstrained (since a single type can implement Fn multiple times for different types).

I’m aware that I can do this easily in a number of ways (e.g. `a[X::A.some_method()]`

, `a[method(X::A)]`

), but I’m interested in whether this can be done as-is.