# HG changeset patch # User Nathan Froyd # Date 1520875539 18000 # Mon Mar 12 12:25:39 2018 -0500 # Node ID fc2c1f3ce833fee02c630ba21516f59b842dac0d # Parent a69c2f9c2b4dde1687c9e5c688688632d9c1b8ac Bug 1437627 - part 1 - separate out a function for rustc's opt level; r=chmanchester We want to use this to compute whether incremental compilation can be used for Rust, so we need access to it outside of rust_compiler_flags. diff --git a/build/moz.configure/toolchain.configure b/build/moz.configure/toolchain.configure --- a/build/moz.configure/toolchain.configure +++ b/build/moz.configure/toolchain.configure @@ -1481,43 +1481,41 @@ set_config('DEVELOPER_OPTIONS', develope js_option(env='RUSTC_OPT_LEVEL', nargs=1, help='Rust compiler optimization level (-C opt-level=%s)') # --enable-release kicks in full optimizations. imply_option('RUSTC_OPT_LEVEL', '2', when='--enable-release') -@depends('RUSTC_OPT_LEVEL', debug_rust, '--enable-debug-symbols', - moz_optimize) -def rust_compiler_flags(opt_level_option, debug_rust, debug_symbols, - moz_optimize): - optimize = moz_optimize.optimize +@depends('RUSTC_OPT_LEVEL', moz_optimize) +def rustc_opt_level(opt_level_option, moz_optimize): + if opt_level_option: + return opt_level_option[0] + else: + return '1' if moz_optimize.optimize else '0' + +@depends(rustc_opt_level, debug_rust, '--enable-debug-symbols') +def rust_compiler_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. # # But we'd also like to support an additional axis of control for # optimization level. Since Cargo only supports 2 profiles, we're in # a bit of a bind. # # 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: - 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 if debug_symbols: debug_info = '2'