Skip to content
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

Test "negative" fails on 32bit systems #15

Open
ignatenkobrain opened this issue Dec 2, 2017 · 1 comment
Open

Test "negative" fails on 32bit systems #15

ignatenkobrain opened this issue Dec 2, 2017 · 1 comment

Comments

@ignatenkobrain
Copy link

---- negative stdout ----
	thread 'negative' panicked at 'assertion failed: `(left == right)`
  left: `None`,
 right: `Some(A)`', tests/tests.rs:192:4
@cuviper
Copy link

cuviper commented Jan 9, 2018

The code only implements from_u64 and from_i64. The rest will be upcast to larger types by the default FromPrimitive methods. So a 32-bit from_usize(!16) will call from_u64(0xffffffef), not sign-extended in any way, so it won't match the negative discriminant.

Either the test should reflect the difference between 32-bit and 64-bit usize, or the implementation needs to change the way it compares values. I guess this is a design choice for the desired behavior.

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

No branches or pull requests

2 participants