Repository navigation
Fix for issue #7588, "Overflow handling of from_str methods is broken" - #9010
aaronlaursen wants to merge 1 commit into
Conversation
|
Thanks for the contribution! Before we merge this though, I think this probably needs two things:
|
|
sounds good- On Thu, Sep 5, 2013 at 9:25 PM, Alex Crichton [email protected]:
|
|
Unit tests are implemented, and the commits are squashed. Let me know if you think anything else needs to be done. On Thu, Sep 5, 2013 at 10:51 PM, Aaron Laursen [email protected]:
|
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.
initial clippy::ref_pattern implementation This implements a new lint that discourages the use of the `ref` keyword as outlined in rust-lang#9010. I think there are still some things to improve about this lint, but I need some feedback before I can implement those. - [x] ~~Maybe it's desirable that a quick fix is listed too, instead of a generic `avoid using the ref keyword` lint.~~ - [x] `let ref x = y` already has a lint (`clippy::toplevel_ref_arg`). This implementation will report this too, so you get two lints for the same issue, which is not great. I don't really know a way around this though. - [X] The dogfood test is currently failing locally, though I ran `cargo clippy -- -D clippy::all -D clippy::pedantic` and got no output, so I'm not sure why this is. Any help with these would be greatly appreciated. fixes rust-lang#9010 changelog: [`ref_pattern`]: newly added lint
9024: internal: Don't store supertraits in ItemTree r=jonas-schievink a=lnicola Closes rust-lang#9010 Co-authored-by: Laurențiu Nicola <[email protected]>
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.