title: Is it possible to mark a potentially uninitialized variable as good without using unsafe or panicking?
body: <p>Is it possible to explain to the compiler that the <code>v</code> variable is good at the line marked as <code>1</code> without using unsafe or code that may call <code>panic!</code>?  </p>
  
  <pre><code>#[derive(PartialEq, Debug)]
  enum Enum {
      V1,
      V2,
      V3,
  }
  
  fn main() {
      let e = Enum::V1;
  
      let mut v: i32;
  
      if e == Enum::V1 || e == Enum::V2 {
          v = 17; //some complex, costy expression
      }
      match e {
          Enum::V1 | Enum::V2 =&gt; {
              println!("Results: {}", v); //1
          }
          _ =&gt; {}
      }
  }
  </code></pre>
  
  <p>The compiler reports:</p>
  
  <pre class="lang-none prettyprint-override"><code>error[E0381]: use of possibly uninitialized variable: `v`
    --&gt; src/main.rs:18:37
     |
  18 |             println!("Results: {}", v); //1
     |                                     ^ use of possibly uninitialized `v`
  </code></pre>
  
  <p>I have a complex expression to initialize <code>v</code> in my real code instead of <code>17</code>, the type of <code>v</code> does not implement <code>Default</code>, and I only need <code>v</code> for the <code>Enum::V1</code> and <code>Enum::V2</code> cases.</p>
  
  <p>In the real code I have separate branches for <code>Enum::V1</code> and <code>Enum::V2</code>, and I can move <code>v</code> initialization there.</p>
  
  <p>I want to make my code more clear and I don't want to use potentially bad things like <code>unsafe</code> or <code>Option::unwrap</code></p>