Skip to content

Commit ccdfb09

Browse files
alexcrichtonManishearth
authored andcommitted
std: Stabilize FromStr and parse
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 rust-lang#15138
1 parent 25212e8 commit ccdfb09

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

reference.md

+1-1
Original file line numberDiff line numberDiff line change
@@ -2994,7 +2994,7 @@ Some examples of call expressions:
29942994
# fn add(x: i32, y: i32) -> i32 { 0 }
29952995
29962996
let x: i32 = add(1i32, 2i32);
2997-
let pi: Option<f32> = "3.14".parse();
2997+
let pi: Option<f32> = "3.14".parse().ok();
29982998
```
29992999

30003000
### Lambda expressions

0 commit comments

Comments
 (0)