Skip to content

Rollup of 9 pull requests #41567

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 26 commits into from
Apr 27, 2017
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
Show all changes
26 commits
Select commit Hold shift + click to select a range
a42c025
Add bootstrap support for android
malbarbo Apr 18, 2017
e1afddc
Haiku: fix initial platform support
jessicah Apr 22, 2017
f8c6436
Step::replace_one should put a one, not a zero (Issue #41492)
scottmcm Apr 24, 2017
e482529
Fix invalid module suggestion
GuillaumeGomez Dec 9, 2016
bd880bc
Add tests for module suggestions
GuillaumeGomez Jan 3, 2017
b10c044
Remove strip prefix
GuillaumeGomez Feb 25, 2017
0d63f13
Haiku: add missing cases of using LIBRARY_PATH
jessicah Apr 24, 2017
c558a2a
Add Hexagon support
michaelwu Apr 9, 2017
3f97b2a
Add ui tests
GuillaumeGomez Apr 24, 2017
7248f67
Build the rustc-src tarball before the rust-src component
cuviper Apr 25, 2017
b9bdb17
Reduce the contents of the rust-src component
cuviper Apr 25, 2017
9f96d0a
Add a regression test for ICE #33287
wesleywiser Apr 26, 2017
32aeb22
Avoid the hexagon backend on old versions of LLVM
michaelwu Apr 25, 2017
85c2ff1
Update num_cpus dependency to 1.x (1.4.0)
jessicah Apr 26, 2017
27b00ec
Cherry pick LLVM hexagon fixes
michaelwu Apr 25, 2017
29e6656
Address platform-specific behavior in TcpStream::shutdown
steveklabnik Apr 24, 2017
22eb3c6
Enable building the LLVM Hexagon target
michaelwu Apr 18, 2017
a3dde0b
Rollup merge of #41370 - malbarbo:android-bootstrap, r=alexcrichton
Apr 26, 2017
639000e
Rollup merge of #41456 - jessicah:haiku-support, r=alexcrichton
Apr 26, 2017
25834dc
Rollup merge of #41493 - scottmcm:fix-step-replace, r=sfackler
Apr 26, 2017
84f6e01
Rollup merge of #41499 - steveklabnik:gh25164, r=alexcrichton
Apr 26, 2017
ccc790f
Rollup merge of #41501 - GuillaumeGomez:invalid_module_location, r=js…
Apr 26, 2017
c6ff832
Rollup merge of #41524 - michaelwu:basic-hexagon, r=alexcrichton
Apr 26, 2017
95c2f06
Rollup merge of #41546 - cuviper:reduced-rust-src, r=alexcrichton
Apr 26, 2017
f69c777
Rollup merge of #41550 - wesleywiser:fix_33287, r=estebank
Apr 26, 2017
60837b1
Rollup merge of #41552 - jessicah:updated-num-cpus-dep, r=alexcrichton
Apr 26, 2017
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Next Next commit
Step::replace_one should put a one, not a zero (Issue #41492)
Turns out all six of these impls are incorrect.
  • Loading branch information
scottmcm committed Apr 24, 2017
commit f8c6436173f9ccbe79eaf021161f26b601eef026
12 changes: 6 additions & 6 deletions src/libcore/iter/range.rs
Original file line number Diff line number Diff line change
Expand Up @@ -86,12 +86,12 @@ macro_rules! step_impl_unsigned {

#[inline]
fn replace_one(&mut self) -> Self {
mem::replace(self, 0)
mem::replace(self, 1)
}

#[inline]
fn replace_zero(&mut self) -> Self {
mem::replace(self, 1)
mem::replace(self, 0)
}

#[inline]
Expand Down Expand Up @@ -157,12 +157,12 @@ macro_rules! step_impl_signed {

#[inline]
fn replace_one(&mut self) -> Self {
mem::replace(self, 0)
mem::replace(self, 1)
}

#[inline]
fn replace_zero(&mut self) -> Self {
mem::replace(self, 1)
mem::replace(self, 0)
}

#[inline]
Expand Down Expand Up @@ -206,12 +206,12 @@ macro_rules! step_impl_no_between {

#[inline]
fn replace_one(&mut self) -> Self {
mem::replace(self, 0)
mem::replace(self, 1)
}

#[inline]
fn replace_zero(&mut self) -> Self {
mem::replace(self, 1)
mem::replace(self, 0)
}

#[inline]
Expand Down
38 changes: 38 additions & 0 deletions src/libcore/tests/iter.rs
Original file line number Diff line number Diff line change
Expand Up @@ -1082,3 +1082,41 @@ fn test_chain_fold() {
assert_eq!(&[2, 3, 1, 2, 0], &result[..]);
}

#[test]
fn test_step_replace_unsigned() {
let mut x = 4u32;
let y = x.replace_zero();
assert_eq!(x, 0);
assert_eq!(y, 4);

x = 5;
let y = x.replace_one();
assert_eq!(x, 1);
assert_eq!(y, 5);
}

#[test]
fn test_step_replace_signed() {
let mut x = 4i32;
let y = x.replace_zero();
assert_eq!(x, 0);
assert_eq!(y, 4);

x = 5;
let y = x.replace_one();
assert_eq!(x, 1);
assert_eq!(y, 5);
}

#[test]
fn test_step_replace_no_between() {
let mut x = 4u128;
let y = x.replace_zero();
assert_eq!(x, 0);
assert_eq!(y, 4);

x = 5;
let y = x.replace_one();
assert_eq!(x, 1);
assert_eq!(y, 5);
}
2 changes: 2 additions & 0 deletions src/libcore/tests/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,7 @@
#![feature(fixed_size_array)]
#![feature(flt2dec)]
#![feature(fmt_internals)]
#![feature(i128_type)]
#![feature(iter_rfind)]
#![feature(libc)]
#![feature(nonzero)]
Expand All @@ -30,6 +31,7 @@
#![feature(sort_internals)]
#![feature(sort_unstable)]
#![feature(step_by)]
#![feature(step_trait)]
#![feature(test)]
#![feature(try_from)]
#![feature(unicode)]
Expand Down