title: Why is the size of a pointer to something on the heap larger than the size of a stack variable?
body: <p>I have the following stack- and heap-allocated variables:</p>
  
  <pre><code>let var1 = 10;
  let var2 = Box::new(10);
  </code></pre>
  
  <p>Printing these outputs the same value, <code>10</code>:</p>
  
  <pre><code>println!("var1 ={} var2 ={}", var1, * var2);
  </code></pre>
  
  <p>When I check the size using <code>mem::size_of_val()</code>, <code>var1</code> is 4 and <code>var2</code> is 8.</p>
  
  <p>Isn't <code>var2</code> a pointer to the heap? Why would a pointer be larger than the stack variable (<code>var1</code>)?</p>
  
  <p>Also, is the use of "<code>*</code>" (i.e., <code>*var2</code>) in the <code>println!()</code> supposed to do anything different? I get 10 either way.</p>