Merge pull request #649 from dtolnay/warnings
Build with -Werror in CI
diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml
index 7139f4a..9e1aef3 100644
--- a/.github/workflows/ci.yml
+++ b/.github/workflows/ci.yml
@@ -29,6 +29,7 @@
flags: /EHsc
env:
CXXFLAGS: ${{matrix.flags}}
+ RUSTFLAGS: --cfg deny_warnings
steps:
- name: Enable symlinks (windows)
if: matrix.os == 'windows'
@@ -45,7 +46,7 @@
# still ensure the test is kept passing on the basis of the scheduled
# builds.
if: matrix.os && github.event_name != 'schedule'
- run: echo 'RUSTFLAGS=--cfg skip_ui_tests' >> $GITHUB_ENV
+ run: echo "RUSTFLAGS=--cfg skip_ui_tests $RUSTFLAGS" >> $GITHUB_ENV
shell: bash
- run: cargo run --manifest-path demo/Cargo.toml
- run: cargo test --workspace --exclude cxx-test-suite
diff --git a/build.rs b/build.rs
index aec0dc9..f799441 100644
--- a/build.rs
+++ b/build.rs
@@ -8,6 +8,7 @@
.cpp(true)
.cpp_link_stdlib(None) // linked via link-cplusplus crate
.flag_if_supported(cxxbridge_flags::STD)
+ .warnings_into_errors(cfg!(deny_warnings))
.compile("cxxbridge1");
println!("cargo:rerun-if-changed=src/cxx.cc");
diff --git a/tests/ffi/build.rs b/tests/ffi/build.rs
index c8f010e..86f8cd3 100644
--- a/tests/ffi/build.rs
+++ b/tests/ffi/build.rs
@@ -10,6 +10,7 @@
let mut build = cxx_build::bridges(sources);
build.file("tests.cc");
build.flag_if_supported(cxxbridge_flags::STD);
+ build.warnings_into_errors(cfg!(deny_warnings));
if cfg!(not(target_env = "msvc")) {
build.define("CXX_TEST_INSTANTIATIONS", None);
}