-
Notifications
You must be signed in to change notification settings - Fork 130
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
73: Avoid `as` casts in default FromPrimitive methods r=cuviper a=cuviper Particularly, the default `from_f64` used `n as i64`, which has undefined behavior on overflow, kind of defeating the purpose here. Now we use a checked `to_i64()` for this, and even try `to_u64()` as a fallback for completeness. Also make similar changes to default `ToPrimitive`, but at least it didn't have the same casting problem. Co-authored-by: Josh Stone <cuviper@gmail.com>
- Loading branch information
Showing
4 changed files
with
130 additions
and
35 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters