Enable share-generics in release bundle builds (#63432)

Cargo joins `build.rustflags` across config sources, so the base
`symbol-mangling-version=v0` and `tokio_unstable` flags still apply
after the newly added config.

With sccache disabled, `cargo build --release -p zed` on macOS: 
Before: zed binary 420677880 bytes
After: zed binary 375109048 bytes (-10.8%, -45.6MB)

After `strip -x` of both
(https://github.com/zed-industries/zed/pull/63429):
313879024 -> 307727432 bytes (-2.0%, -6.2MB)
The rest of the delta is the smaller symbol table. `drop_glue`
instantiations: 101778 -> 65041.

Release Notes:

- N/A
This commit is contained in:
Kirill Bulatov authored and GitHub committed 2026-08-31 05:42:11 +00:00
1 parent 6dc2206180
commit c032dcc3bc
4 files changed
+14 -9

No files matched your search

+5
View File
@@ -0,0 +1,5 @@
[env]
RUSTC_BOOTSTRAP = "1"
[build]
rustflags = ["-Z", "share-generics=y"]
+2 -2
View File
@@ -83,7 +83,7 @@ if [[ "$(uname -m)" == "aarch64" ]]; then
else
export RUSTFLAGS="${RUSTFLAGS:-} -C link-args=-Wl,--disable-new-dtags,-rpath,\$ORIGIN/../lib"
fi
cargo build --release --target "${target_triple}" --package zed --package cli
cargo --config .cargo/bundle-config.toml build --release --target "${target_triple}" --package zed --package cli
# Build remote_server in separate invocation to prevent feature unification from other crates
# from influencing dynamic libraries required by it.
if [[ "$remote_server_triple" == "$musl_triple" ]]; then
@@ -91,7 +91,7 @@ if [[ "$remote_server_triple" == "$musl_triple" ]]; then
musl_cc_var="CC_$(echo "$remote_server_triple" | tr '-' '_')"
export "$musl_cc_var"=musl-gcc
fi
cargo build --release --target "${remote_server_triple}" --package remote_server
cargo --config .cargo/bundle-config.toml build --release --target "${remote_server_triple}" --package remote_server
# Upload debug info to sentry.io
if ! command -v sentry-cli >/dev/null 2>&1; then
+2 -2
View File
@@ -87,10 +87,10 @@ script/generate-licenses
rustup target add $target_triple
echo "Compiling zed binaries"
cargo build ${build_flag} --package zed --package cli --target $target_triple
cargo --config .cargo/bundle-config.toml build ${build_flag} --package zed --package cli --target $target_triple
# Build remote_server in separate invocation to prevent feature unification from other crates
# from influencing dynamic libraries required by it.
cargo build ${build_flag} --package remote_server --target $target_triple
cargo --config .cargo/bundle-config.toml build ${build_flag} --package remote_server --target $target_triple
echo "Creating application bundle"
pushd crates/zed
+5 -5
View File
@@ -116,20 +116,20 @@ function GenerateLicenses {
function BuildZedAndItsFriends {
Write-Output "Building Zed and its friends, for channel: $channel"
# Build zed.exe, cli.exe and auto_update_helper.exe
cargo build --release --package zed --package cli --package auto_update_helper --target $target
cargo --config .cargo/bundle-config.toml build --release --package zed --package cli --package auto_update_helper --target $target
Copy-Item -Path ".\$CargoOutDir\zed.exe" -Destination "$innoDir\Zed.exe" -Force
Copy-Item -Path ".\$CargoOutDir\cli.exe" -Destination "$innoDir\cli.exe" -Force
Copy-Item -Path ".\$CargoOutDir\auto_update_helper.exe" -Destination "$innoDir\auto_update_helper.exe" -Force
# Build explorer_command_injector.dll
switch ($channel) {
"stable" {
cargo build --release --features stable --no-default-features --package explorer_command_injector --target $target
cargo --config .cargo/bundle-config.toml build --release --features stable --no-default-features --package explorer_command_injector --target $target
}
"preview" {
cargo build --release --features preview --no-default-features --package explorer_command_injector --target $target
cargo --config .cargo/bundle-config.toml build --release --features preview --no-default-features --package explorer_command_injector --target $target
}
default {
cargo build --release --package explorer_command_injector --target $target
cargo --config .cargo/bundle-config.toml build --release --package explorer_command_injector --target $target
}
}
Copy-Item -Path ".\$CargoOutDir\explorer_command_injector.dll" -Destination "$innoDir\zed_explorer_command_injector.dll" -Force
@@ -137,7 +137,7 @@ function BuildZedAndItsFriends {
function BuildRemoteServer {
Write-Output "Building remote_server for $target"
cargo build --release --package remote_server --target $target
cargo --config .cargo/bundle-config.toml build --release --package remote_server --target $target
# Create zipped remote server binary
$remoteServerSrc = (Resolve-Path ".\$CargoOutDir\remote_server.exe").Path