title: Why do I get an error when pattern matching a struct-like enum variant with fields?
body: <p>I can't get rid of an error on this code:</p>
  
  <pre><code>#[derive(PartialEq, Copy, Clone)]
  pub enum OperationMode {
      ECB,
      CBC { iv: [u8; 16] },
  }
  
  pub struct AES {
      key: Vec&lt;u8&gt;,
      nr: u8,
      mode: OperationMode,
  }
  
  impl AES {
      pub fn decrypt(&amp;mut self, input: &amp;Vec&lt;u8&gt;) {
          match self.mode {
              OperationMode::ECB =&gt; {},
              OperationMode::CBC(_) =&gt; {},
          };
      }
  }
  </code></pre>
  
  <p>The pattern matching at the end of the <code>decrypt</code> function gives an error: </p>
  
  <pre class="lang-none prettyprint-override"><code>error[E0532]: expected tuple struct/variant, found struct variant `OperationMode::CBC`
    --&gt; src/main.rs:17:13
     |
  17 |             OperationMode::CBC(_) =&gt; {},
     |             ^^^^^^^^^^^^^^^^^^ did you mean `OperationMode::CBC { /* fields */ }`?
  </code></pre>
  
  <p>It tells me to look at the output of <code>rustc --explain E0532</code> for help, which I did.</p>
  
  <p>They show this example of wrong code:</p>
  
  <blockquote>
  <pre><code>enum State {
      Succeeded,
      Failed(String),
  }
  
  fn print_on_failure(state: &amp;State) {
      match *state {
          // error: expected unit struct/variant or constant, found tuple
          //        variant `State::Failed`
          State::Failed =&gt; println!("Failed"),
          _ =&gt; ()
      }
  }
  </code></pre>
  </blockquote>
  
  <p>In this example, the error occurs because <code>State::Failed</code> has a field which isn't matched. It should be <code>State::Failed(ref msg)</code>.</p>
  
  <p>In my case I'm matching the field of my enum because I'm doing  <code>OperationMode::CBC(_)</code>. Why does the error happen?</p>