diff --git a/Cargo.lock b/Cargo.lock index 6a2981d204d3..14cbb30b3ac0 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -1798,7 +1798,6 @@ dependencies = [ "env_logger", "lazy_static", "log", - "winapi", ] [[package]] diff --git a/config/makefiles/rust.mk b/config/makefiles/rust.mk index abd218185819..7311ab0ed619 100644 --- a/config/makefiles/rust.mk +++ b/config/makefiles/rust.mk @@ -59,6 +59,37 @@ cargo_build_flags += -Zbuild-std=std,panic_abort RUSTFLAGS += -Zsanitizer=thread endif +# These flags are passed via `cargo rustc` and only apply to the final rustc +# invocation (i.e., only the top-level crate, not its dependencies). +cargo_rustc_flags = $(CARGO_RUSTCFLAGS) +ifndef DEVELOPER_OPTIONS +ifndef MOZ_DEBUG_RUST +# Enable link-time optimization for release builds, but not when linking +# gkrust_gtest. And not when doing cross-language LTO. +ifndef MOZ_LTO_RUST_CROSS +ifeq (,$(findstring gkrust_gtest,$(RUST_LIBRARY_FILE))) +cargo_rustc_flags += -Clto +endif +# We need -Cembed-bitcode=yes for all crates when using -Clto. +RUSTFLAGS += -Cembed-bitcode=yes +endif +endif +endif + +ifdef CARGO_INCREMENTAL +export CARGO_INCREMENTAL +endif + +rustflags_neon = +ifeq (neon,$(MOZ_FPU)) +ifneq (,$(filter thumbv7neon-,$(RUST_TARGET))) +# Enable neon and disable restriction to 16 FPU registers when neon is enabled +# but we're not using a thumbv7neon target, where it's already the default. +# (CPUs with neon have 32 FPU registers available) +rustflags_neon += -C target_feature=+neon,-d16 +endif +endif + rustflags_sancov = ifdef LIBFUZZER ifndef MOZ_TSAN @@ -84,40 +115,6 @@ endif endif endif -# These flags are passed via `cargo rustc` and only apply to the final rustc -# invocation (i.e., only the top-level crate, not its dependencies). -cargo_rustc_flags = $(CARGO_RUSTCFLAGS) -ifndef DEVELOPER_OPTIONS -ifndef MOZ_DEBUG_RUST -# Enable link-time optimization for release builds, but not when linking -# gkrust_gtest. And not when doing cross-language LTO. -ifndef MOZ_LTO_RUST_CROSS -# Never enable when sancov is enabled to work around https://github.com/rust-lang/rust/issues/90300. -ifndef rustflags_sancov -ifeq (,$(findstring gkrust_gtest,$(RUST_LIBRARY_FILE))) -cargo_rustc_flags += -Clto -endif -# We need -Cembed-bitcode=yes for all crates when using -Clto. -RUSTFLAGS += -Cembed-bitcode=yes -endif -endif -endif -endif - -ifdef CARGO_INCREMENTAL -export CARGO_INCREMENTAL -endif - -rustflags_neon = -ifeq (neon,$(MOZ_FPU)) -ifneq (,$(filter thumbv7neon-,$(RUST_TARGET))) -# Enable neon and disable restriction to 16 FPU registers when neon is enabled -# but we're not using a thumbv7neon target, where it's already the default. -# (CPUs with neon have 32 FPU registers available) -rustflags_neon += -C target_feature=+neon,-d16 -endif -endif - rustflags_override = $(MOZ_RUST_DEFAULT_FLAGS) $(rustflags_neon) ifdef DEVELOPER_OPTIONS diff --git a/mozglue/static/rust/build.rs b/mozglue/static/rust/build.rs index b1e756522bc9..e7daf97c882f 100644 --- a/mozglue/static/rust/build.rs +++ b/mozglue/static/rust/build.rs @@ -38,7 +38,7 @@ fn main() { println!("cargo:rerun-if-changed=wrappers.cpp"); let ver = version().unwrap(); - let max_oom_hook_version = Version::parse("1.58.0-alpha").unwrap(); + let max_oom_hook_version = Version::parse("1.57.0-alpha").unwrap(); if ver < max_oom_hook_version { println!("cargo:rustc-cfg=feature=\"oom_with_hook\""); diff --git a/taskcluster/ci/fetch/toolchains.yml b/taskcluster/ci/fetch/toolchains.yml index ffe3a5a2f535..8557335a043c 100644 --- a/taskcluster/ci/fetch/toolchains.yml +++ b/taskcluster/ci/fetch/toolchains.yml @@ -373,6 +373,13 @@ clang-10: repo: https://github.com/llvm/llvm-project revision: d32170dbd5b0d54436537b6b75beaf44324e0c28 +clang-12: + description: clang 12.0.1 source code + fetch: + type: git + repo: https://github.com/llvm/llvm-project + revision: fed41342a82f5a3a9201819a82bf7a48313e296b + clang-13: description: clang 13.0.0 source code fetch: @@ -389,22 +396,22 @@ clang-trunk: repo: https://github.com/llvm/llvm-project branch: main -# This revision currently corresponds to rust nightly-2021-09-05, -# which is the first nightly with the version 1.57.0, +# This revision currently corresponds to rust nightly-2021-07-25, +# which is the first nightly with the version 1.56.0, # so it should be as close as possible to the behaviour of -# stable-1.56.0. +# stable-1.55.0. # # We use this to build from source, so the resulting non-official -# artifacts will report their version as "1.57.0-dev", but will otherwise +# artifacts will report their version as "1.56.0-dev", but will otherwise # behave like a nightly build. This means they will allow you to use # unstable features like -Zbuild-std and sanitizers. -rust-1.57.0-dev: - description: Rust 1.57.0-dev source code +rust-1.56.0-dev: + description: Rust 1.56.0-dev source code fetch: type: git include-dot-git: true repo: https://github.com/rust-lang/rust/ - revision: 5d2a410ff78247c418e28b69f7cad02bdd2168d6 + revision: d9aa28767287670df6cf823b94629122e04442c0 wasi-sdk: description: wasi-sdk source code diff --git a/taskcluster/ci/spidermonkey/linux.yml b/taskcluster/ci/spidermonkey/linux.yml index 3240be037a5f..aaa7c82b5bbd 100644 --- a/taskcluster/ci/spidermonkey/linux.yml +++ b/taskcluster/ci/spidermonkey/linux.yml @@ -430,7 +430,9 @@ sm-fuzzing-linux64/opt: spidermonkey-variant: fuzzing fetches: toolchain: - - linux64-clang-13 + # Keep this with clang-12 until we move to rust 1.56 that uses the same + # LLVM-13 backend as clang-13 + - linux64-clang-12 - linux64-rust - linux64-cbindgen - linux64-dump_syms diff --git a/taskcluster/ci/toolchain/clang.yml b/taskcluster/ci/toolchain/clang.yml index 04cdb5ad23af..6ff87c563984 100644 --- a/taskcluster/ci/toolchain/clang.yml +++ b/taskcluster/ci/toolchain/clang.yml @@ -130,6 +130,27 @@ linux64-clang-trunk: - linux64-toolchain-sysroot - wasm32-wasi-compiler-rt +linux64-clang-12: + description: "Clang 12 toolchain build" + attributes: + local-toolchain: true + treeherder: + symbol: TL(clang12) + run-on-projects: [trunk] + run: + using: toolchain-script + script: build-clang.sh + arguments: + - 'build/build-clang/clang-12-linux64.json' + resources: + - 'build/build-clang/clang-12-linux64.json' + toolchain-artifact: public/build/clang.tar.zst + fetches: + fetch: + - clang-12 + toolchain: + - linux64-toolchain-sysroot + linux64-clang-13: description: "Clang 13 toolchain build" attributes: diff --git a/taskcluster/ci/toolchain/dump-syms.yml b/taskcluster/ci/toolchain/dump-syms.yml index 0e7d105f9b43..640d2fda2247 100644 --- a/taskcluster/ci/toolchain/dump-syms.yml +++ b/taskcluster/ci/toolchain/dump-syms.yml @@ -25,7 +25,7 @@ linux64-dump_syms: toolchain: - linux64-binutils - linux64-clang-13 - - linux64-rust-1.56 + - linux64-rust-1.55 - sysroot-x86_64-linux-gnu macosx64-dump_syms: @@ -37,7 +37,7 @@ macosx64-dump_syms: toolchain-artifact: public/build/dump_syms.tar.zst fetches: toolchain: - - linux64-rust-macos-1.56 + - linux64-rust-macos-1.55 - linux64-clang-13 - linux64-cctools-port-clang-13 - macosx64-sdk-11.0 @@ -51,7 +51,7 @@ macosx64-aarch64-dump_syms: toolchain-artifact: public/build/dump_syms.tar.zst fetches: toolchain: - - linux64-rust-macos-1.56 + - linux64-rust-macos-1.55 - linux64-clang-13 - linux64-cctools-port-clang-13 - macosx64-sdk-11.0 @@ -70,4 +70,4 @@ win64-dump_syms: tooltool-downloads: internal fetches: toolchain: - - win64-rust-1.56 + - win64-rust-1.55 diff --git a/taskcluster/ci/toolchain/rust.yml b/taskcluster/ci/toolchain/rust.yml index adc66d5cd79e..3f82444f3fb2 100644 --- a/taskcluster/ci/toolchain/rust.yml +++ b/taskcluster/ci/toolchain/rust.yml @@ -44,12 +44,12 @@ linux64-rust-1.53: toolchain: - linux64-clang -linux64-rust-1.56: +linux64-rust-1.55: treeherder: symbol: TL(rust) run: arguments: [ - '--channel', '1.56.0', + '--channel', '1.55.0', '--host', 'x86_64-unknown-linux-gnu', '--target', 'x86_64-unknown-linux-gnu', '--target', 'i686-unknown-linux-gnu', @@ -80,19 +80,19 @@ linux64-rust-dev: ] fetches: fetch: - - rust-1.57.0-dev + - rust-1.56.0-dev toolchain: - linux64-clang - linux64-binutils -linux64-rust-cross-1.56: +linux64-rust-cross-1.55: description: "rust repack with macos and windows cross support" treeherder: symbol: TL(rust-cross) run: arguments: [ - '--channel', '1.56.0', + '--channel', '1.55.0', '--host', 'x86_64-unknown-linux-gnu', '--target', 'x86_64-unknown-linux-gnu', '--target', 'i686-unknown-linux-gnu', @@ -109,13 +109,13 @@ linux64-rust-cross-1.56: ] toolchain-alias: linux64-rust-cross -linux64-rust-static-1.56: +linux64-rust-static-1.55: description: "rust repack with static linking support" treeherder: symbol: TL(rust-static) run: arguments: [ - '--channel', '1.56.0', + '--channel', '1.55.0', '--host', 'x86_64-unknown-linux-gnu', '--target', 'x86_64-unknown-linux-gnu', '--target', 'x86_64-unknown-linux-musl', @@ -161,13 +161,13 @@ linux64-rust-macos-1.53: '--target', 'x86_64-apple-darwin', ] -linux64-rust-macos-1.56: +linux64-rust-macos-1.55: description: "rust repack with macos-cross support" treeherder: - symbol: TL(rust-macos-1.56) + symbol: TL(rust-macos-1.55) run: arguments: [ - '--channel', '1.56.0', + '--channel', '1.55.0', '--host', 'x86_64-unknown-linux-gnu', '--target', 'x86_64-unknown-linux-gnu', '--target', 'x86_64-apple-darwin', @@ -175,13 +175,13 @@ linux64-rust-macos-1.56: ] toolchain-alias: linux64-rust-macos -linux64-rust-android-1.56: +linux64-rust-android-1.55: description: "rust repack with android-cross support" treeherder: symbol: TL(rust-android) run: arguments: [ - '--channel', '1.56.0', + '--channel', '1.55.0', '--host', 'x86_64-unknown-linux-gnu', '--target', 'x86_64-unknown-linux-gnu', '--target', 'armv7-linux-androideabi', @@ -222,13 +222,13 @@ linux64-rust-windows-1.53: '--target', 'i686-pc-windows-msvc', ] -linux64-rust-windows-1.56: +linux64-rust-windows-1.55: description: "rust repack with windows-cross support" treeherder: symbol: TL(rust-win) run: arguments: [ - '--channel', '1.56.0', + '--channel', '1.55.0', '--host', 'x86_64-unknown-linux-gnu', '--target', 'x86_64-unknown-linux-gnu', '--target', 'x86_64-pc-windows-msvc', @@ -260,12 +260,12 @@ win64-rust-1.53: '--target', 'aarch64-pc-windows-msvc', ] -win64-rust-1.56: +win64-rust-1.55: treeherder: symbol: TW64(rust) run: arguments: [ - '--channel', '1.56.0', + '--channel', '1.55.0', '--host', 'x86_64-pc-windows-msvc', '--target', 'x86_64-pc-windows-msvc', '--target', 'i686-pc-windows-msvc', @@ -273,12 +273,12 @@ win64-rust-1.56: ] toolchain-alias: win64-rust -macosx64-rust-1.56: +macosx64-rust-1.55: treeherder: symbol: TM(rust) run: arguments: [ - '--channel', '1.56.0', + '--channel', '1.55.0', '--host', 'x86_64-apple-darwin', '--target', 'x86_64-apple-darwin', ] @@ -297,12 +297,12 @@ mingw32-rust-1.53: '--target', 'x86_64-unknown-linux-gnu', ] -mingw32-rust-1.56: +mingw32-rust-1.55: treeherder: symbol: TMW(rust) run: arguments: [ - '--channel', '1.56.0', + '--channel', '1.55.0', '--host', 'x86_64-unknown-linux-gnu', '--target', 'i686-unknown-linux-gnu', '--target', 'i686-pc-windows-gnu', diff --git a/toolkit/crashreporter/test/unit/xpcshell.ini b/toolkit/crashreporter/test/unit/xpcshell.ini index a5ea435dccfa..76c2b78b6c09 100644 --- a/toolkit/crashreporter/test/unit/xpcshell.ini +++ b/toolkit/crashreporter/test/unit/xpcshell.ini @@ -40,8 +40,6 @@ skip-if = (os != 'win' && os != 'linux') || (os=='linux' && bits==32) [test_crash_terminator.js] [test_crash_backgroundtask_moz_crash.js] -skip-if = os == 'win' -reason = Race condition that makes it fail too frequently [test_crash_heap_corruption.js] skip-if = os != 'win' diff --git a/xpcom/rust/gecko_logger/Cargo.toml b/xpcom/rust/gecko_logger/Cargo.toml index 9a1a1ebb8619..73af4386796f 100644 --- a/xpcom/rust/gecko_logger/Cargo.toml +++ b/xpcom/rust/gecko_logger/Cargo.toml @@ -10,6 +10,3 @@ lazy_static = "1" log = {version = "0.4", features = ["release_max_level_info"]} env_logger = {version = "0.8", default-features = false} # disable `regex` to reduce code size app_services_logger = { path = "../../../services/common/app_services_logger" } - -[target."cfg(windows)".dependencies] -winapi = "0.3" diff --git a/xpcom/rust/gecko_logger/src/lib.rs b/xpcom/rust/gecko_logger/src/lib.rs index ff1fdf1044e6..da85ff92e51c 100644 --- a/xpcom/rust/gecko_logger/src/lib.rs +++ b/xpcom/rust/gecko_logger/src/lib.rs @@ -159,8 +159,6 @@ pub struct GeckoLogger { logger: env_logger::Logger, } -pub struct GeckoLoggerInitError(()); - impl GeckoLogger { pub fn new() -> GeckoLogger { let mut builder = env_logger::Builder::new(); @@ -177,24 +175,14 @@ impl GeckoLogger { GeckoLogger { logger } } - pub fn init() -> Result<(), GeckoLoggerInitError> { - #[cfg(windows)] - unsafe { - // Work around https://github.com/rust-lang/rust/issues/88576. - use winapi::um::processenv::GetStdHandle; - use winapi::um::winbase::{STD_ERROR_HANDLE, STD_OUTPUT_HANDLE}; - if GetStdHandle(STD_OUTPUT_HANDLE).is_null() || GetStdHandle(STD_ERROR_HANDLE).is_null() - { - return Err(GeckoLoggerInitError(())); - } - } + pub fn init() -> Result<(), log::SetLoggerError> { let gecko_logger = Self::new(); // The max level may have already been set by gecko_logger. Don't // set it to a lower level. let level = cmp::max(log::max_level(), gecko_logger.logger.filter()); log::set_max_level(level); - log::set_boxed_logger(Box::new(gecko_logger)).map_err(|_| GeckoLoggerInitError(())) + log::set_boxed_logger(Box::new(gecko_logger)) } fn should_log_to_app_services(target: &str) -> bool {