Skip to content

Fixes type range issue during linting (#16684) #17013

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

Merged
merged 1 commit into from
Sep 9, 2014

Conversation

robertg
Copy link

@robertg robertg commented Sep 5, 2014

@robertg robertg changed the title Fixes type range issue during linting (#16684) Fix type range issue during linting (#16684) Sep 5, 2014
@robertg robertg changed the title Fix type range issue during linting (#16684) Fixes type range issue during linting (#16684) Sep 5, 2014
@robertg
Copy link
Author

robertg commented Sep 5, 2014

When I run make check, the type bounds tests fail, such as:

/users/rdgawdzi/dev/rust/src/test/compile-fail/lint-type-overflow.rs:57:14: 57:41 error: literal out of range for its type
/users/rdgawdzi/dev/rust/src/test/compile-fail/lint-type-overflow.rs:57     let x =  1.7976931348623159e+308_f64; //~ error: literal out of range for its type

This is a good thing judging by the comments, but should these tests be rewritten so the error is actually handled, and the build passes?

@alexcrichton
Copy link
Member

Could you add a test for #16684? Also yes, the tests will need to be fixed before landing.

@robertg
Copy link
Author

robertg commented Sep 5, 2014

I will merge in and combine #16962, which adds a test for the fix, but the build failed because I wasn't converting the min/max range properly to positive: (since: i8::MIN as u64 // => 18446744073709551488)

 - Ensures the propagated negation sign is properly utilized during type
   checking.
 - Removed redundant type checking, specifically regarding the out of bounds checking
   on a bounded type.
 - Closes rust-lang#16684
@robertg
Copy link
Author

robertg commented Sep 5, 2014

The tests now pass: test [compile-fail] compile-fail/lint-type-overflow.rs ... ok

alexcrichton added a commit to alexcrichton/rust that referenced this pull request Sep 9, 2014
@bors bors merged commit 5eea93a into rust-lang:master Sep 9, 2014
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.

i64::MIN literal out of range warning
3 participants