Skip to content

Convert between BigInts, BigUints, ints, and uints #9014

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed
wants to merge 2 commits into from

Conversation

dcrewi
Copy link
Contributor

@dcrewi dcrewi commented Sep 6, 2013

No description provided.

@anasazi
Copy link
Contributor

anasazi commented Sep 6, 2013

I'm hesitant about negative BigInts going to zero. Maybe it should return an Option instead?

@dcrewi
Copy link
Contributor Author

dcrewi commented Sep 6, 2013

I did wonder somewhat about that, but chose to copy what's done in to_uint. Maybe they both need to change?

@thestinger
Copy link
Contributor

The to_uint function also needs to check for overflow if it doesn't already.

Previously, conversion to ints, uints, and BigUints clamped the value
within the range of that datatype. With this commit, conversion
overflows fail the task. To handle overflows gracefully, use the new
to_*_opt() methods.
@bors bors closed this Sep 12, 2013
flip1995 pushed a commit to flip1995/rust that referenced this pull request Jun 30, 2022
…, r=dswij

Fix `extra_unused_lifetimes` false positive

This PR fixes rust-lang#9014.

I confirmed the FP on the `crates.io` source as `@JohnTitor` mentioned, and confirmed that the FP is no longer present following this change.

I did not include a test in this PR because I think constructing one would be complicated, and the fix is pretty simple. But please let me know if this is unacceptable.

changelog: fix `extra_unused_lifetimes` FP
flip1995 pushed a commit to flip1995/rust that referenced this pull request Jun 30, 2022
This commit adds test for a `extra_unused_lifetimes` false positive from derive (rust-lang#9014).

The fix for the FP is introduced in rust-lang#9037.
flip1995 pushed a commit to flip1995/rust that referenced this pull request Jun 30, 2022
`extra_unused_lifetimes` add FP test case emitting from derived attributes.

Add test to cover for rust-lang#9014 which is fixed in rust-lang#9037.

changelog: [`extra_unused_lifetimes`] Add FP test case emitting from derived attributes.

---

Seeing the FP from the test:

```sh
$ git revert -m 1 1d1ae10
$ TESTNAME=extra_unused_lifetime cargo uitest
```
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

5 participants