mozilla/rust — pull request #9010 by aaronlaursen (2013-09-06 02:17:10+00:00)
Title: Fix for issue #7588, "Overflow handling of from_str methods is broken"

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.