title: Convert string slice to int in Rust
body: <blockquote>
    <p><strong>Note</strong> The code in this question pertains to a version of Rust before 1.0 but the answers have been updated for Rust 1.0.</p>
  </blockquote>
  
  <p>I have trouble converting a string to an integer.</p>
  
  <pre><code>fn main() {
      let input_text = io::stdin()
          .read_line()
          .ok()
          .expect("failed to read line");
  
      let input: Option&lt;int&gt; = from_str(input_text.as_slice());
  
      println!("{}", input);
  }
  </code></pre>
  
  <p>I enter a number on the console (42 for example) and my program prints <code>None</code>.</p>
  
  <p><a href="http://doc.rust-lang.org/std/from_str/trait.FromStr.html" rel="nofollow noreferrer">The documentation says</a> that that is a normal situation when the string is ill-formatted, but what's wrong with my <code>42</code>?</p>