Bug 1513009 - Deny Rust warnings on automation. r=firefox-build-system-reviewers,ted

I've chosen linux64-debug since it's the most visible build I usually do, but I
could do another build task or something, or use the static analysis builds, or
what not. Just let me know if there's a better way to do this.

Caveat: This might make updating Rust toolchains a bit more painful. I think
this is better and we should just deal with warnings before updating toolchains,
but I don't know if there'd be strong opposition to that.

Note that this does _not_ affect third-party code since Cargo passes
`--cap-lint warn` automatically for those.

Proof that it works:

 * https://treeherder.mozilla.org/#/jobs?repo=try&revision=4ad1e4e1392f71b574cff683e90c7b13bf8781d1
 * https://treeherder.mozilla.org/#/jobs?repo=try&revision=57604f92624bbe49037eee87c56fdb6bf2b5017d

Differential Revision: https://phabricator.services.mozilla.com/D14083

--HG--
extra : moz-landing-system : lando
This commit is contained in:
Emilio Cobos Álvarez 2018-12-13 19:17:31 +00:00
Родитель 1192c781f5
Коммит d29a39cdfd
3 изменённых файлов: 18 добавлений и 3 удалений

Просмотреть файл

@ -16,3 +16,9 @@ add_old_configure_assignment(
'_COMPILATION_HOST_CFLAGS', compilation_flags.host_cflags)
add_old_configure_assignment(
'_COMPILATION_HOST_CXXFLAGS', compilation_flags.host_cxxflags)
@depends(rust_compile_flags, rust_warning_flags)
def rust_flags(compile_flags, warning_flags):
return compile_flags + warning_flags
set_config('MOZ_RUST_DEFAULT_FLAGS', rust_flags)

Просмотреть файл

@ -1655,7 +1655,7 @@ def rustc_opt_level(opt_level_option, moz_optimize):
@depends(rustc_opt_level, debug_rust, '--enable-debug-symbols')
def rust_compiler_flags(opt_level, debug_rust, debug_symbols):
def rust_compile_flags(opt_level, debug_rust, debug_symbols):
# Cargo currently supports only two interesting profiles for building:
# development and release. Those map (roughly) to --enable-debug and
# --disable-debug in Gecko, respectively.
@ -1696,8 +1696,6 @@ def rust_compiler_flags(opt_level, debug_rust, debug_symbols):
return flags
set_config('MOZ_RUST_DEFAULT_FLAGS', rust_compiler_flags)
# Rust incremental compilation
# ==============================================================

Просмотреть файл

@ -13,6 +13,17 @@ add_old_configure_assignment(
depends('--enable-warnings-as-errors')(lambda x: bool(x)))
@depends('--enable-warnings-as-errors')
def rust_warning_flags(warnings_as_errors):
flags = []
# Note that cargo passes --cap-lints warn to rustc for third-party code, so
# we don't need a very complicated setup.
if warnings_as_errors:
flags.append('-Dwarnings')
return flags
# GCC/Clang warnings:
# https://gcc.gnu.org/onlinedocs/gcc/Warning-Options.html
# https://clang.llvm.org/docs/DiagnosticsReference.html