title: "cannot move out of borrowed content" when replacing a struct field
body: <p>Consider this example:</p>
  
  <pre class="lang-rust prettyprint-override"><code>struct Item {
      x: u32,
  }
  
  impl Item {
      pub fn increment(self, amount: u32) -&gt; Self {
          Item { x: self.x + amount }
      }
  }
  
  struct Container {
      item: Item,
  }
  
  impl Container {
      pub fn increment_item(&amp;mut self, amount: u32) {
          // This line causes "cannot move out of borrowed content"
          self.item = self.item.increment(amount);
      }
  }
  </code></pre>
  
  <p>As you can see, <code>Item.increment</code> consumes the item and returns a new instance.</p>
  
  <p>In <code>Container.increment_item</code> I want to replace the current item with the one returned by <code>Item.increment</code> but the compiler yells at me with a <code>cannot move out of borrowed content</code> error.</p>
  
  <p>In <code>Container.increment_item</code> <code>self</code> is <code>mut</code> so I can mutate its fields, I don't understand why the compiler doesn't allow me to do it.</p>
  
  <p>I know that I can make <code>Container.increment_item</code> consumes <code>self</code> and return a new object, like <code>Item.increment</code> does, and it works, but I would like to understand why I'm getting the error and how can I fix it when I really can't consume the container.</p>