From 18413dbf9bd3ddb9f81302d4fd2cff6c0ee480bf Mon Sep 17 00:00:00 2001 From: Daniel Paoliello Date: Wed, 3 Sep 2025 17:02:52 -0700 Subject: [PATCH] Update cc-rs to 1.2.33 --- Cargo.lock | 17 +++++++++++------ Cargo.toml | 4 ++-- compiler/rustc_codegen_ssa/Cargo.toml | 4 +--- compiler/rustc_codegen_ssa/src/back/link.rs | 6 +++--- compiler/rustc_codegen_ssa/src/back/linker.rs | 5 ++--- compiler/rustc_llvm/Cargo.toml | 5 ++--- compiler/rustc_windows_rc/Cargo.toml | 4 +--- compiler/rustc_windows_rc/src/lib.rs | 8 +++----- src/tools/tidy/src/deps.rs | 1 + src/tools/tidy/src/extdeps.rs | 1 + 10 files changed, 27 insertions(+), 28 deletions(-) diff --git a/Cargo.lock b/Cargo.lock index c29c3158d4a1b..c55dc418a7b10 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -462,9 +462,9 @@ version = "0.1.0" [[package]] name = "cc" -version = "1.2.16" +version = "1.2.33" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "be714c154be609ec7f5dad223a33bf1482fff90472de28f7362806e6d4832b8c" +checksum = "3ee0f8803222ba5a7e2777dd72ca451868909b1ac410621b676adf07280e9b5f" dependencies = [ "jobserver", "libc", @@ -1325,6 +1325,12 @@ dependencies = [ "windows-sys 0.59.0", ] +[[package]] +name = "find-msvc-tools" +version = "0.1.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "e178e4fba8a2726903f6ba98a6d221e76f9c12c650d5dc0e6afdc50677b49650" + [[package]] name = "flate2" version = "1.1.2" @@ -3523,7 +3529,7 @@ dependencies = [ "ar_archive_writer", "bitflags", "bstr", - "cc", + "find-msvc-tools", "itertools", "libc", "object 0.37.3", @@ -4725,7 +4731,7 @@ dependencies = [ name = "rustc_windows_rc" version = "0.0.0" dependencies = [ - "cc", + "find-msvc-tools", ] [[package]] @@ -5427,8 +5433,7 @@ version = "0.1.0" [[package]] name = "tikv-jemalloc-sys" version = "0.6.0+5.3.0-1-ge13ca993e8ccb9ba9847cc330696e02839f328f7" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "cd3c60906412afa9c2b5b5a48ca6a5abe5736aec9eb48ad05037a677e52e4e2d" +source = "git+https://github.com/dpaoliello/jemallocator.git?branch=temp#329682034ae0b8f7cca4514146b211d7dc694c9c" dependencies = [ "cc", "libc", diff --git a/Cargo.toml b/Cargo.toml index 67c7a9d67edc8..0ce5059293624 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -91,5 +91,5 @@ codegen-units = 1 # If you want to use a crate with local modifications, you can set a path or git dependency here. # For git dependencies, also add your source to ALLOWED_SOURCES in src/tools/tidy/src/extdeps.rs. -#[patch.crates-io] - +[patch.crates-io] +tikv-jemalloc-sys = { git = 'https://github.com/dpaoliello/jemallocator.git', branch = 'temp' } diff --git a/compiler/rustc_codegen_ssa/Cargo.toml b/compiler/rustc_codegen_ssa/Cargo.toml index 5462163f4ffd3..e50f73eca424f 100644 --- a/compiler/rustc_codegen_ssa/Cargo.toml +++ b/compiler/rustc_codegen_ssa/Cargo.toml @@ -8,9 +8,7 @@ edition = "2024" ar_archive_writer = "0.5" bitflags = "2.4.1" bstr = "1.11.3" -# `cc` updates often break things, so we pin it here. Cargo enforces "max 1 semver-compat version -# per crate", so if you change this, you need to also change it in `rustc_llvm` and `rustc_windows_rc`. -cc = "=1.2.16" +find-msvc-tools = "0.1.0" itertools = "0.12" pathdiff = "0.2.0" regex = "1.4" diff --git a/compiler/rustc_codegen_ssa/src/back/link.rs b/compiler/rustc_codegen_ssa/src/back/link.rs index 48b01ea2df197..371f2c1a6a299 100644 --- a/compiler/rustc_codegen_ssa/src/back/link.rs +++ b/compiler/rustc_codegen_ssa/src/back/link.rs @@ -9,7 +9,7 @@ use std::path::{Path, PathBuf}; use std::process::{Output, Stdio}; use std::{env, fmt, fs, io, mem, str}; -use cc::windows_registry; +use find_msvc_tools; use itertools::Itertools; use regex::Regex; use rustc_arena::TypedArena; @@ -877,9 +877,9 @@ fn link_natively( // All Microsoft `link.exe` linking ror codes are // four digit numbers in the range 1000 to 9999 inclusive if is_msvc_link_exe && (code < 1000 || code > 9999) { - let is_vs_installed = windows_registry::find_vs_version().is_ok(); + let is_vs_installed = find_msvc_tools::find_vs_version().is_ok(); let has_linker = - windows_registry::find_tool(&sess.target.arch, "link.exe").is_some(); + find_msvc_tools::find_tool(&sess.target.arch, "link.exe").is_some(); sess.dcx().emit_note(errors::LinkExeUnexpectedError); diff --git a/compiler/rustc_codegen_ssa/src/back/linker.rs b/compiler/rustc_codegen_ssa/src/back/linker.rs index a2efd420a327a..dff9f1eb06288 100644 --- a/compiler/rustc_codegen_ssa/src/back/linker.rs +++ b/compiler/rustc_codegen_ssa/src/back/linker.rs @@ -4,7 +4,7 @@ use std::io::prelude::*; use std::path::{Path, PathBuf}; use std::{env, io, iter, mem, str}; -use cc::windows_registry; +use find_msvc_tools; use rustc_hir::def_id::{CrateNum, LOCAL_CRATE}; use rustc_metadata::{ find_native_static_library, try_find_native_dynamic_library, try_find_native_static_library, @@ -53,7 +53,7 @@ pub(crate) fn get_linker<'a>( self_contained: bool, target_cpu: &'a str, ) -> Box { - let msvc_tool = windows_registry::find_tool(&sess.target.arch, "link.exe"); + let msvc_tool = find_msvc_tools::find_tool(&sess.target.arch, "link.exe"); // If our linker looks like a batch script on Windows then to execute this // we'll need to spawn `cmd` explicitly. This is primarily done to handle @@ -117,7 +117,6 @@ pub(crate) fn get_linker<'a>( if sess.target.is_like_msvc && let Some(ref tool) = msvc_tool { - cmd.args(tool.args()); for (k, v) in tool.env() { if k == "PATH" { new_path.extend(env::split_paths(v)); diff --git a/compiler/rustc_llvm/Cargo.toml b/compiler/rustc_llvm/Cargo.toml index 0dfd1b13df502..45011f9b446cb 100644 --- a/compiler/rustc_llvm/Cargo.toml +++ b/compiler/rustc_llvm/Cargo.toml @@ -10,9 +10,8 @@ libc = "0.2.73" [build-dependencies] # tidy-alphabetical-start -# `cc` updates often break things, so we pin it here. Cargo enforces "max 1 semver-compat version -# per crate", so if you change this, you need to also change it in `rustc_codegen_ssa` and `rustc_windows_rc`. -cc = "=1.2.16" +# `cc` updates often break things, so we pin it here. +cc = "=1.2.33" # tidy-alphabetical-end [features] diff --git a/compiler/rustc_windows_rc/Cargo.toml b/compiler/rustc_windows_rc/Cargo.toml index 080acd35c38cb..5bf9b5ea94f73 100644 --- a/compiler/rustc_windows_rc/Cargo.toml +++ b/compiler/rustc_windows_rc/Cargo.toml @@ -5,7 +5,5 @@ edition = "2024" [dependencies] #tidy-alphabetical-start -# `cc` updates often break things, so we pin it here. Cargo enforces "max 1 semver-compat version -# per crate", so if you change this, you need to also change it in `rustc_llvm` and `rustc_codegen_ssa`. -cc = "=1.2.16" +find-msvc-tools = "0.1.0" #tidy-alphabetical-end diff --git a/compiler/rustc_windows_rc/src/lib.rs b/compiler/rustc_windows_rc/src/lib.rs index caa5e5ef27656..c5c29ef634a31 100644 --- a/compiler/rustc_windows_rc/src/lib.rs +++ b/compiler/rustc_windows_rc/src/lib.rs @@ -4,8 +4,6 @@ //! to set the product and file version information in the Windows resource file. use std::{env, ffi, fs, path, process}; -use cc::windows_registry; - /// The template for the Windows resource file. const RESOURCE_TEMPLATE: &str = include_str!("../rustc.rc.in"); @@ -141,11 +139,11 @@ fn find_resource_compiler(arch_or_target: &str) -> Option { /// Find a Windows SDK tool for the given architecture or target triple. /// Returns `None` if the tool could not be found. fn find_windows_sdk_tool(arch_or_target: &str, tool_name: &str) -> Option { - // windows_registry::find_tool can only find MSVC tools, not Windows SDK tools, but + // find_msvc_tools can only find MSVC tools, not Windows SDK tools, but // cc does include the Windows SDK tools in the PATH environment of MSVC tools. - let msvc_linker = windows_registry::find_tool(arch_or_target, "link.exe")?; - let path = &msvc_linker.env().iter().find(|(k, _)| k == "PATH")?.1; + let msvc_linker = find_msvc_tools::find_tool(arch_or_target, "link.exe")?; + let path = &msvc_linker.env().into_iter().find(|(k, _)| k == "PATH")?.1; find_tool_in_path(tool_name, path) } diff --git a/src/tools/tidy/src/deps.rs b/src/tools/tidy/src/deps.rs index fee48bea144de..ed1bc02759ae2 100644 --- a/src/tools/tidy/src/deps.rs +++ b/src/tools/tidy/src/deps.rs @@ -275,6 +275,7 @@ const PERMITTED_RUSTC_DEPENDENCIES: &[&str] = &[ "expect-test", "fallible-iterator", // dependency of `thorin` "fastrand", + "find-msvc-tools", "flate2", "fluent-bundle", "fluent-langneg", diff --git a/src/tools/tidy/src/extdeps.rs b/src/tools/tidy/src/extdeps.rs index bc217a55cc199..c54b091b3e6cb 100644 --- a/src/tools/tidy/src/extdeps.rs +++ b/src/tools/tidy/src/extdeps.rs @@ -8,6 +8,7 @@ const ALLOWED_SOURCES: &[&str] = &[ r#""registry+https://github.com/rust-lang/crates.io-index""#, // This is `rust_team_data` used by `site` in src/tools/rustc-perf, r#""git+https://github.com/rust-lang/team#a5260e76d3aa894c64c56e6ddc8545b9a98043ec""#, + r#""git+https://github.com/dpaoliello/jemallocator.git?branch=temp#329682034ae0b8f7cca4514146b211d7dc694c9c""#, ]; /// Checks for external package sources. `root` is the path to the directory that contains the