Bug 1416490 - Check for a value passed to RUSTC_OPT_LEVEL rather than whether its value was a default. draft
authorChris Manchester <cmanchester@mozilla.com>
Mon, 13 Nov 2017 22:07:46 -0800
changeset 697783 1c8294de969c1ed67f7ac43c2701ac057f3f7f82
parent 697265 06b4c8d613eb93611de373cdd0c380491bdc7f8e
child 697784 c64943406acc4cafdd75c6f04b4d1ccbb5f8d661
push id89090
push usercmanchester@mozilla.com
push dateTue, 14 Nov 2017 17:10:26 +0000
bugs1416490
milestone59.0a1
Bug 1416490 - Check for a value passed to RUSTC_OPT_LEVEL rather than whether its value was a default. The current code will fail if "RUSTC_OPT_LEVEL=" is passed. This can happen if the value isn't present and that fact is injected into js' configure. We only want to respect RUSTC_OPT_LEVEL if a value is passed, so we simply check for the presence of a value rather than its origin. MozReview-Commit-ID: 6GhLfprJEEn
build/moz.configure/toolchain.configure
--- a/build/moz.configure/toolchain.configure
+++ b/build/moz.configure/toolchain.configure
@@ -1346,17 +1346,17 @@ def rust_compiler_flags(opt_level_option
     # Code here derives various compiler options given other configure options.
     # The options defined here effectively override defaults specified in
     # Cargo.toml files.
 
     opt_level = None
     debug_assertions = None
     debug_info = None
 
-    if opt_level_option.origin != 'default':
+    if opt_level_option:
         opt_level = opt_level_option[0]
     else:
         opt_level = '1' if optimize else '0'
 
     # opt-level=0 implies -C debug-assertions, which may not be desired
     # unless Rust debugging is enabled.
     if opt_level == '0' and not debug_rust:
         debug_assertions = False