rollup merge of #21718: alexcrichton/stabilize-from-str

This commits adds an associated type to the `FromStr` trait representing an
error payload for parses which do not succeed. The previous return value,
`Option<Self>` did not allow for this form of payload. After the associated type
was added, the following attributes were applied:

* `FromStr` is now stable
* `FromStr::Err` is now stable
* `FromStr::from_str` is now stable
* `StrExt::parse` is now stable
* `FromStr for bool` is now stable
* `FromStr for $float` is now stable
* `FromStr for $integral` is now stable
* Errors returned from stable `FromStr` implementations are stable
* Errors implement `Display` and `Error` (both impl blocks being `#[stable]`)

Closes #15138
This commit is contained in:
Alex Crichton
2015-01-30 12:03:20 -08:00
39 changed files with 389 additions and 260 deletions

View File

@@ -76,7 +76,6 @@ use std::old_io;
use std::iter::repeat;
use std::num::{Float, Int};
use std::os;
use std::str::FromStr;
use std::sync::mpsc::{channel, Sender};
use std::thread::{self, Thread};
use std::thunk::{Thunk, Invoke};
@@ -820,7 +819,7 @@ fn get_concurrency() -> uint {
use std::rt;
match os::getenv("RUST_TEST_TASKS") {
Some(s) => {
let opt_n: Option<uint> = FromStr::from_str(s.as_slice());
let opt_n: Option<uint> = s.parse().ok();
match opt_n {
Some(n) if n > 0 => n,
_ => panic!("RUST_TEST_TASKS is `{}`, should be a positive integer.", s)