-
Notifications
You must be signed in to change notification settings - Fork 13.2k
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
fix silent overflows on Step
impls
#36365
Conversation
@@ -916,6 +916,20 @@ fn test_range_step() { | |||
} | |||
|
|||
#[test] | |||
#[should_panic] | |||
fn test_range_overflow_unsigned() { | |||
let mut it = u8::MAX..; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Won't these tests fail if compiled in release mode?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Ahh, that's a good point. Then these have to be run-fail with the overflow checking forced on (see src/test/run-fail/*overflow*.rs
).
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
See #36372 for reference on making these tests.
@bors r+ Thanks! |
📌 Commit 065bf4b has been approved by |
⌛ Testing commit 065bf4b with merge 0154682... |
💔 Test failed - auto-win-msvc-64-opt-rustbuild |
@bors: retry On Tue, Sep 13, 2016 at 7:18 PM, bors notifications@github.com wrote:
|
⌛ Testing commit 065bf4b with merge 16ca4ec... |
💔 Test failed - auto-win-gnu-32-opt-rustbuild |
Test doesn't pass and needs update |
Could this also use the strategy in another PR to use |
Sorry for the inactivity. I've been traveling for a few weeks. @alexcrichton Can you elaborate, or link the PR if you remember which one it was? |
@@ -95,11 +95,13 @@ macro_rules! step_impl_unsigned { | |||
} | |||
|
|||
#[inline] | |||
#[rustc_inherit_overflow_checks] | |||
fn add_one(&self) -> Self { | |||
*self + 1 |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Add::add(*self, 1)
is what @alexcrichton meant. Similar situation on the rest.
MIN and MAX were breaking the build for me. min_value and max_value do not.
Looks like travis failures may be legit? |
I'm missing something here. My tests are failing on explicit panic instead of overflowing as expected. |
The current failures look like:
I think these tests should be |
Looks like travis may unfortunately still be failing?
|
Looks like travis is passing now, r? @eddyb |
@bors r+ |
📌 Commit 8f19d5c has been approved by |
Part of #36110
r? @eddyb