]> git.lizzy.rs Git - rust.git/commit
auto merge of #9010 : aaronlaursen/rust/master, r=alexcrichton
authorbors <bors@rust-lang.org>
Sat, 7 Sep 2013 03:10:57 +0000 (20:10 -0700)
committerbors <bors@rust-lang.org>
Sat, 7 Sep 2013 03:10:57 +0000 (20:10 -0700)
commit25f3b29c61122bcf160d273348327723cd783419
tree23bce629648ef1685e5cf3a7ea51f9b073111708
parent12bca20d781cf4f6810c1cfc1666c1adb1d5d97f
parentcaf5321eb45db8ba64d3f9f4b9e16febfeb46a4c
auto merge of #9010 : aaronlaursen/rust/master, r=alexcrichton

Here's a fix for issue #7588, "Overflow handling of from_str methods is broken".

The integer overflow issues are taken care of by checking to see if the multiply-by-radix-and-add-next-digit process is reversible. If it overflowed, then some information is lost and the process is irreversible, in which case, None is returned.

Floats now consistently return Some(Inf) of Some(-Inf) on overflow thanks to a call to NumStrConv::inf() and NumStrConv::neg_inf() respectively when the overflow is detected (which yields a value of None in the case of ints and uints anyway).

This is my first contribution to Rust, and my first time using the language in general, so any and all feedback is appreciated.
src/libstd/num/strconv.rs