Skip to content

Apache DataFusion SQL Query Engine

ARROW-3868: [Rust] Switch to nightly Rust for required build, stable is now allowed to fail

Andy Grovea5e3cb527aee
diff --git a/.travis.yml b/.travis.yml
index 457e656618..b877e205b5 100644
--- a/.travis.yml
+++ b/.travis.yml
@@ -280,8 +280,8 @@ matrix:
- if [ $ARROW_CI_RUST_AFFECTED != "1" ]; then exit; fi
- $TRAVIS_BUILD_DIR/ci/travis_install_cargo.sh
script:
- - RUSTUP_TOOLCHAIN=stable $TRAVIS_BUILD_DIR/ci/travis_script_rust.sh
- - RUSTUP_TOOLCHAIN=nightly $TRAVIS_BUILD_DIR/ci/travis_script_rust.sh || true
+ - RUSTUP_TOOLCHAIN=stable $TRAVIS_BUILD_DIR/ci/travis_script_rust.sh || true
+ - RUSTUP_TOOLCHAIN=nightly $TRAVIS_BUILD_DIR/ci/travis_script_rust.sh
after_success:
- pushd ${TRAVIS_BUILD_DIR}/rust
# Run coverage for codecov.io
diff --git a/ci/rust-build-main.bat b/ci/rust-build-main.bat
index 463fdc0a93..c8a51fef6e 100644
--- a/ci/rust-build-main.bat
+++ b/ci/rust-build-main.bat
@@ -25,15 +25,15 @@ pushd rust
rustup default stable
rustup show
-cargo build --target %TARGET% || exit /B
-cargo build --target %TARGET% --release || exit /B
+cargo build --target %TARGET%
+cargo build --target %TARGET% --release
@echo Test (debug)
@echo ------------
-cargo test --target %TARGET% || exit /B
+cargo test --target %TARGET%
@echo
@echo Test (release)
@echo --------------
-cargo test --target %TARGET% --release || exit /B
+cargo test --target %TARGET% --release
@echo ===================================
@echo Build with nightly toolchain
@@ -41,20 +41,20 @@ cargo test --target %TARGET% --release || exit /B
rustup default nightly
rustup show
-cargo build --target %TARGET%
-cargo build --target %TARGET% --release
+cargo build --target %TARGET% || exit /B
+cargo build --target %TARGET% --release || exit /B
@echo Test (debug)
@echo ------------
-cargo test --target %TARGET%
+cargo test --target %TARGET% || exit /B
@echo
@echo Test (release)
@echo --------------
-cargo test --target %TARGET% --release
+cargo test --target %TARGET% --release || exit /B
@echo
@echo Run example (release)
@echo ---------------------
-cargo run --example builders --target %TARGET% --release
-cargo run --example dynamic_types --target %TARGET% --release
-cargo run --example read_csv --target %TARGET% --release
+cargo run --example builders --target %TARGET% --release || exit /B
+cargo run --example dynamic_types --target %TARGET% --release || exit /B
+cargo run --example read_csv --target %TARGET% --release || exit /B
popd
diff --git a/ci/travis_script_rust.sh b/ci/travis_script_rust.sh
index 1058ec251a..02a32cdabe 100755
--- a/ci/travis_script_rust.sh
+++ b/ci/travis_script_rust.sh
@@ -26,9 +26,13 @@ pushd $RUST_DIR
# show activated toolchain
rustup show
-# raises on any formatting errors
-rustup component add rustfmt-preview
-cargo fmt --all -- --check
+# check code formatting only for Rust nightly
+if [ $RUSTUP_TOOLCHAIN == "nightly" ]
+then
+ # raises on any formatting errors
+ rustup component add rustfmt-preview
+ cargo fmt --all -- --check
+fi
# raises on any warnings
cargo rustc -- -D warnings
diff --git a/dev/release/verify-release-candidate.sh b/dev/release/verify-release-candidate.sh
index 378dca3865..5b666630d1 100755
--- a/dev/release/verify-release-candidate.sh
+++ b/dev/release/verify-release-candidate.sh
@@ -268,10 +268,14 @@ test_rust() {
# build and test rust
pushd rust
- # raises on any formatting errors (disabled, because RC1 has a couple)
- # rustup component add rustfmt-preview
- # cargo fmt --all -- --check
+ # we are targeting Rust nightly for releases
+ rustup default nightly
+
+ # raises on any formatting errors
+ rustup component add rustfmt-preview
+ cargo fmt --all -- --check
# raises on any warnings
+
cargo rustc -- -D warnings
cargo build
diff --git a/rust/benches/builder.rs b/rust/benches/builder.rs
index 4d09d94805..5edc344d2a 100644
--- a/rust/benches/builder.rs
+++ b/rust/benches/builder.rs
@@ -41,7 +41,8 @@ fn bench_primitive(c: &mut Criterion) {
}
black_box(builder.finish());
})
- }).throughput(Throughput::Bytes(
+ })
+ .throughput(Throughput::Bytes(
(data.len() * NUM_BATCHES * size_of::<i64>()) as u32,
)),
);
@@ -63,7 +64,8 @@ fn bench_bool(c: &mut Criterion) {
}
black_box(builder.finish());
})
- }).throughput(Throughput::Bytes(
+ })
+ .throughput(Throughput::Bytes(
(data_len * NUM_BATCHES * size_of::<bool>()) as u32,
)),
);
diff --git a/rust/src/buffer.rs b/rust/src/buffer.rs
index cec38dbcff..67d2896b33 100644
--- a/rust/src/buffer.rs
+++ b/rust/src/buffer.rs
@@ -523,7 +523,8 @@ mod tests {
let buffer_copy = thread::spawn(move || {
// access buffer in another thread.
buffer.clone()
- }).join();
+ })
+ .join();
assert!(buffer_copy.is_ok());
assert_eq!(buffer2, buffer_copy.ok().unwrap());
diff --git a/rust/src/csv/reader.rs b/rust/src/csv/reader.rs
index 0a8a6e4102..9f7d78382b 100644
--- a/rust/src/csv/reader.rs
+++ b/rust/src/csv/reader.rs
@@ -174,7 +174,8 @@ impl Reader {
other
))),
}
- }).collect();
+ })
+ .collect();
match arrays {
Ok(arr) => Some(Ok(RecordBatch::new(self.schema.clone(), arr))),
diff --git a/rust/src/tensor.rs b/rust/src/tensor.rs
index 933946fcf0..a9f933ffb6 100644
--- a/rust/src/tensor.rs
+++ b/rust/src/tensor.rs
@@ -96,7 +96,8 @@ macro_rules! impl_tensor {
.iter()
.map(|i| {
assert_eq!(s.len(), i.len(), "shape and stride dimensions differ")
- }).next();
+ })
+ .next();
names
.iter()
.map(|i| {
@@ -105,7 +106,8 @@ macro_rules! impl_tensor {
i.len(),
"number of dimensions and number of dimension names differ"
)
- }).next();
+ })
+ .next();
}
};
Self {