bug 1409276 - disable warnings-as-errors for Rust libraries/programs. r?build
When compiling C/C++ sources via Rust build scripts there's no point in
enabling warnings-as-errors as all such code is third-party code.
MozReview-Commit-ID: 5pGH6w9ZE2I
--- a/build/templates.mozbuild
+++ b/build/templates.mozbuild
@@ -58,16 +58,18 @@ def AllowCompilerWarnings():
COMPILE_FLAGS['WARNINGS_AS_ERRORS'] = []
@template
def RustLibrary(name, features=None, target_dir=None):
'''Template for Rust libraries.'''
Library(name)
IS_RUST_LIBRARY = True
+ # Some Rust build scripts compile C/C++ sources, don't error on warnings for them.
+ AllowCompilerWarnings()
if features:
RUST_LIBRARY_FEATURES = features
if target_dir:
RUST_LIBRARY_TARGET_DIR = target_dir
@@ -123,16 +125,18 @@ def HostLibrary(name):
HOST_LIBRARY_NAME = name
@template
def HostRustLibrary(name, features=None):
'''Template for host Rust libraries.'''
HostLibrary(name)
IS_RUST_LIBRARY = True
+ # Some Rust build scripts compile C/C++ sources, don't error on warnings for them.
+ AllowCompilerWarnings()
if features:
HOST_RUST_LIBRARY_FEATURES = features
@template
def DisableStlWrapping():
COMPILE_FLAGS['STL'] = []
--- a/testing/geckodriver/moz.build
+++ b/testing/geckodriver/moz.build
@@ -1,13 +1,15 @@
# This Source Code Form is subject to the terms of the Mozilla Public
# License, v. 2.0. If a copy of the MPL was not distributed with this
# file, You can obtain one at http://mozilla.org/MPL/2.0/.
RUST_PROGRAMS += ["geckodriver"]
+# Some Rust build scripts compile C/C++ sources, don't error on warnings for them.
+AllowCompilerWarnings()
# https://bugzil.la/1425365
if CONFIG["OS_ARCH"] != "WINNT":
RUST_TESTS = [
"geckodriver",
"webdriver",
# TODO: Move to mozbase/rust/moz.build once those crates can be