[tor-commits] [tor/release-0.3.4] Make Rust warnings conditionally fatal

nickm at torproject.org nickm at torproject.org
Sat Jun 16 14:20:33 UTC 2018


commit 468bf58fa24d78bef8d0d017dcacb7da4c031c12
Author: Taylor Yu <catalyst at torproject.org>
Date:   Fri Jun 15 17:27:19 2018 -0500

    Make Rust warnings conditionally fatal
    
    Set rustc flags to treat warnings as fatal if configured with
    --enable-warnings.
---
 configure.ac              | 6 ++++++
 src/rust/.cargo/config.in | 3 +++
 2 files changed, 9 insertions(+)

diff --git a/configure.ac b/configure.ac
index d554ba8e5..5269d9c42 100644
--- a/configure.ac
+++ b/configure.ac
@@ -462,6 +462,11 @@ if test "x$enable_rust" = "xyes"; then
   fi
 
   AC_DEFINE([HAVE_RUST], 1, [have Rust])
+  if test "x$enable_fatal_warnings" = "xyes"; then
+    RUST_WARN=
+  else
+    RUST_WARN=#
+  fi
   if test "x$enable_cargo_online_mode" = "xyes"; then
     CARGO_ONLINE=
     RUST_DL=#
@@ -515,6 +520,7 @@ if test "x$enable_rust" = "xyes"; then
 
   AC_SUBST(TOR_RUST_STATIC_NAME)
   AC_SUBST(CARGO_ONLINE)
+  AC_SUBST(RUST_WARN)
   AC_SUBST(RUST_DL)
 
   dnl Let's check the rustc version, too
diff --git a/src/rust/.cargo/config.in b/src/rust/.cargo/config.in
index 301e7fdbe..70481bbcb 100644
--- a/src/rust/.cargo/config.in
+++ b/src/rust/.cargo/config.in
@@ -6,3 +6,6 @@
 
 @RUST_DL@ [source.vendored-sources]
 @RUST_DL@ directory = '@TOR_RUST_DEPENDENCIES@'
+
+ at RUST_WARN@ [build]
+ at RUST_WARN@ rustflags = [ "-D", "warnings" ]
\ No newline at end of file





More information about the tor-commits mailing list