title: Crash while trying to do bit shift
body: <p>I am trying to run this rust code</p>
  
  <pre><code>use std::net::Ipv4Addr;
  
  fn ip_to_int(addr: Ipv4Addr) -&gt; u32 {
          let ip = addr.octets();
          (ip[0] as u32) &lt;&lt; 24 + (ip[1] as u32) &lt;&lt; 16 + (ip[2] as u32) &lt;&lt; 8 + (ip[3] as u32)
      }
  
  fn main() {
      let ip = Ipv4Addr::new(74, 125, 227, 0);
      println!("{}", ip_to_int(ip));
  }
  </code></pre>
  
  <p>This crashes with</p>
  
  <pre><code>thread '&lt;main&gt;' panicked at 'shift operation overflowed', test.rs:5
  </code></pre>
  
  <p>I did typecast everything to 32 bit ints and no shift is larger than 32 bits. Why does it crash? Also, isn't the compiler supposed to catch this and prevent compilation?</p>
  
  <pre><code>Abhishek@Abhisheks-MacBook-Pro-2:~$ rustc --version
  rustc 1.1.0-nightly (21f278a68 2015-04-23) (built 2015-04-24)
  </code></pre>