Closed arielb1 closed 7 years ago
Enum discriminants can be accessed in today's Rust without doing a read of all the interior of the enum:
fn main() { let mut t = Some(0); let y = if let Some(ref mut y) = t { y } else { panic!(); }; if let Some(_) = t { println!("{}", y); } }
I think the smartest way to handle this is to treat discriminants as their own separate field. This might warrant a note in the RFC.
Sorry for being tedious here - I am trying to use the borrowck part of this RFC as a specification to check against while reviewing MIR borrowck.
This is a very good point. I agree with the idea of them being a kind of field.
Enum discriminants can be accessed in today's Rust without doing a read of all the interior of the enum:
I think the smartest way to handle this is to treat discriminants as their own separate field. This might warrant a note in the RFC.
Sorry for being tedious here - I am trying to use the borrowck part of this RFC as a specification to check against while reviewing MIR borrowck.