Skip to content

armgit / zed

Public Imported from GitHub
0

Code at the speed of thought – Zed is a high-performance, multiplayer code editor from the creators of Atom and Tree-sitter.

Share generics better and strip rodio audio features (#64260)

Kirill Bulatov9930d2c2a3c3
diff --git a/.cargo/bundle-config.toml b/.cargo/bundle-config.toml
index 66c1f2ec086..c3f18fb9555 100644
--- a/.cargo/bundle-config.toml
+++ b/.cargo/bundle-config.toml
@@ -1,5 +1,14 @@
[env]
RUSTC_BOOTSTRAP = "1"
-[build]
+[target.'cfg(all())']
rustflags = ["-Z", "share-generics=y"]
+
+[target.'cfg(target_os = "linux")']
+rustflags = ["-C", "link-args=-Wl,--disable-new-dtags,-rpath,$ORIGIN/../lib"]
+
+[target.'cfg(all(target_os = "linux", target_env = "musl"))']
+rustflags = ["-C", "target-feature=+crt-static"]
+
+[target.aarch64-unknown-linux-musl]
+rustflags = ["-C", "link-arg=-fuse-ld=lld"]
diff --git a/.cargo/config.toml b/.cargo/config.toml
index a9bf1f9cc97..8ed5893b99e 100644
--- a/.cargo/config.toml
+++ b/.cargo/config.toml
@@ -1,4 +1,4 @@
-[build]
+[target.'cfg(all())']
# v0 mangling scheme provides more detailed backtraces around closures
rustflags = ["-C", "symbol-mangling-version=v0", "--cfg", "tokio_unstable"]
diff --git a/.config/typos.toml b/.config/typos.toml
index 9e3bb541dfb..4c1a01055c3 100644
--- a/.config/typos.toml
+++ b/.config/typos.toml
@@ -116,5 +116,6 @@ extend-ignore-re = [
check-filename = true
[default.extend-words]
+flate = "flate"
scap = "scap"
writeable = "writeable"
diff --git a/Cargo.lock b/Cargo.lock
index eedc24dbdd9..172b5dc004f 100644
--- a/Cargo.lock
+++ b/Cargo.lock
@@ -223,6 +223,12 @@ version = "2.0.1"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "320119579fcad9c21884f5c4861d16174d0e06250625266f50fe6898340abefa"
+[[package]]
+name = "adler32"
+version = "1.2.0"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "aae1277d39aeec15cb388266ecc24b11c80469deae6067e17a1a7aa9e5c1f234"
+
[[package]]
name = "aes"
version = "0.8.4"
@@ -315,7 +321,7 @@ dependencies = [
"web_search",
"zed_env_vars",
"zlog",
- "zstd",
+ "zstd 0.11.2+zstd.1.5.2",
]
[[package]]
@@ -4292,7 +4298,7 @@ dependencies = [
"serde_json",
"system_specs",
"windows 0.62.2",
- "zstd",
+ "zstd 0.11.2+zstd.1.5.2",
]
[[package]]
@@ -4765,6 +4771,12 @@ dependencies = [
"syn 2.0.117",
]
+[[package]]
+name = "dary_heap"
+version = "0.3.9"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "8b1e3a325bc115f096c8b77bbf027a7c2592230e70be2d985be950d3d5e60ebe"
+
[[package]]
name = "dashmap"
version = "6.1.0"
@@ -5406,7 +5418,7 @@ dependencies = [
"zed_credentials_provider",
"zeta_prompt",
"zlog",
- "zstd",
+ "zstd 0.11.2+zstd.1.5.2",
]
[[package]]
@@ -8805,6 +8817,39 @@ version = "1.12.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "e7c5cedc30da3a610cac6b4ba17597bdf7152cf974e8aab3afb3d54455e371c8"
+[[package]]
+name = "include-flate"
+version = "0.3.4"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "48f173716febb1ad596c16ea5637b5f1790ea32de8e627493ff82bc73b0876ce"
+dependencies = [
+ "include-flate-codegen",
+ "include-flate-compress",
+]
+
+[[package]]
+name = "include-flate-codegen"
+version = "0.3.4"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "4a7875b62a72ad3f3203cdd8950d4cf9947db036030b974b8b37ceae90c8d8c0"
+dependencies = [
+ "include-flate-compress",
+ "proc-macro-error3",
+ "proc-macro2",
+ "quote",
+ "syn 2.0.117",
+]
+
+[[package]]
+name = "include-flate-compress"
+version = "0.3.4"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "44fbb9c5ccb9a5b67b4afa2974c27e5507ea1bf6d22828cef418e4dfaeca51dd"
+dependencies = [
+ "libflate",
+ "zstd 0.13.3",
+]
+
[[package]]
name = "indenter"
version = "0.3.4"
@@ -9971,6 +10016,30 @@ dependencies = [
"pkg-config",
]
+[[package]]
+name = "libflate"
+version = "2.3.1"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "a4da9b700e758e57152a1fd1c52cbdc5727c1aa6d8743dc1acda917398f1d76c"
+dependencies = [
+ "adler32",
+ "crc32fast",
+ "dary_heap",
+ "libflate_lz77",
+ "no_std_io2",
+]
+
+[[package]]
+name = "libflate_lz77"
+version = "2.3.0"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "ff7a10e427698aef6eef269482776debfef63384d30f13aad39a1a95e0e098fd"
+dependencies = [
+ "hashbrown 0.16.1",
+ "no_std_io2",
+ "rle-decode-fast",
+]
+
[[package]]
name = "libfuzzer-sys"
version = "0.4.10"
@@ -11395,6 +11464,15 @@ dependencies = [
"memoffset",
]
+[[package]]
+name = "no_std_io2"
+version = "0.9.4"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "418abd1b6d34fbf6cae440dc874771b0525a604428704c76e48b29a5e67b8003"
+dependencies = [
+ "memchr",
+]
+
[[package]]
name = "node_runtime"
version = "0.1.0"
@@ -13900,6 +13978,28 @@ dependencies = [
"version_check",
]
+[[package]]
+name = "proc-macro-error-attr3"
+version = "3.1.1"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "9e564d14133360e1ae169ffde5da25881b5fa47261665b8e5713c212c27799da"
+dependencies = [
+ "proc-macro2",
+ "quote",
+]
+
+[[package]]
+name = "proc-macro-error3"
+version = "3.1.1"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "8f0d4471b3436c22106b21913b1dda531558918ae9b7ec55d58aa84b43552233"
+dependencies = [
+ "proc-macro-error-attr3",
+ "proc-macro2",
+ "quote",
+ "syn 3.0.3",
+]
+
[[package]]
name = "proc-macro2"
version = "1.0.107"
@@ -15452,6 +15552,12 @@ dependencies = [
"syn 1.0.109",
]
+[[package]]
+name = "rle-decode-fast"
+version = "1.0.3"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "3582f63211428f83597b51b2ddb88e2a91a9d52d12831f9d08f5e624e8977422"
+
[[package]]
name = "rmp"
version = "0.8.14"
@@ -15567,7 +15673,7 @@ dependencies = [
"tracing",
"util",
"zlog",
- "zstd",
+ "zstd 0.11.2+zstd.1.5.2",
]
[[package]]
@@ -15638,6 +15744,7 @@ version = "8.11.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "04113cb9355a377d83f06ef1f0a45b8ab8cd7d8b1288160717d66df5c7988d27"
dependencies = [
+ "include-flate",
"rust-embed-impl",
"rust-embed-utils",
"walkdir",
@@ -17760,53 +17867,12 @@ source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "5773a4c030a19d9bfaa090f49746ff35c75dfddfa700df7a5939d5e076a57039"
dependencies = [
"lazy_static",
- "symphonia-bundle-flac",
- "symphonia-bundle-mp3",
- "symphonia-codec-aac",
"symphonia-codec-pcm",
- "symphonia-codec-vorbis",
"symphonia-core",
- "symphonia-format-isomp4",
- "symphonia-format-ogg",
"symphonia-format-riff",
"symphonia-metadata",
]
-[[package]]
-name = "symphonia-bundle-flac"
-version = "0.5.5"
-source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "c91565e180aea25d9b80a910c546802526ffd0072d0b8974e3ebe59b686c9976"
-dependencies = [
- "log",
- "symphonia-core",
- "symphonia-metadata",
- "symphonia-utils-xiph",
-]
-
-[[package]]
-name = "symphonia-bundle-mp3"
-version = "0.5.5"
-source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "4872dd6bb56bf5eac799e3e957aa1981086c3e613b27e0ac23b176054f7c57ed"
-dependencies = [
- "lazy_static",
- "log",
- "symphonia-core",
- "symphonia-metadata",
-]
-
-[[package]]
-name = "symphonia-codec-aac"
-version = "0.5.5"
-source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "4c263845aa86881416849c1729a54c7f55164f8b96111dba59de46849e73a790"
-dependencies = [
- "lazy_static",
- "log",
- "symphonia-core",
-]
-
[[package]]
name = "symphonia-codec-pcm"
version = "0.5.5"
@@ -17817,17 +17883,6 @@ dependencies = [
"symphonia-core",
]
-[[package]]
-name = "symphonia-codec-vorbis"
-version = "0.5.5"
-source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "f025837c309cd69ffef572750b4a2257b59552c5399a5e49707cc5b1b85d1c73"
-dependencies = [
- "log",
- "symphonia-core",
- "symphonia-utils-xiph",
-]
-
[[package]]
name = "symphonia-core"
version = "0.5.5"
@@ -17841,31 +17896,6 @@ dependencies = [
"log",
]
-[[package]]
-name = "symphonia-format-isomp4"
-version = "0.5.5"
-source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "243739585d11f81daf8dac8d9f3d18cc7898f6c09a259675fc364b382c30e0a5"
-dependencies = [
- "encoding_rs",
- "log",
- "symphonia-core",
- "symphonia-metadata",
- "symphonia-utils-xiph",
-]
-
-[[package]]
-name = "symphonia-format-ogg"
-version = "0.5.5"
-source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "2b4955c67c1ed3aa8ae8428d04ca8397fbef6a19b2b051e73b5da8b1435639cb"
-dependencies = [
- "log",
- "symphonia-core",
- "symphonia-metadata",
- "symphonia-utils-xiph",
-]
-
[[package]]
name = "symphonia-format-riff"
version = "0.5.5"
@@ -17890,16 +17920,6 @@ dependencies = [
"symphonia-core",
]
-[[package]]
-name = "symphonia-utils-xiph"
-version = "0.5.5"
-source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "ee27c85ab799a338446b68eec77abf42e1a6f1bb490656e121c6e27bfbab9f16"
-dependencies = [
- "symphonia-core",
- "symphonia-metadata",
-]
-
[[package]]
name = "syn"
version = "1.0.109"
@@ -23406,7 +23426,7 @@ dependencies = [
"pbkdf2 0.11.0",
"sha1",
"time",
- "zstd",
+ "zstd 0.11.2+zstd.1.5.2",
]
[[package]]
@@ -23442,7 +23462,16 @@ version = "0.11.2+zstd.1.5.2"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "20cc960326ece64f010d2d2107537f26dc589a6573a316bd5b1dba685fa5fde4"
dependencies = [
- "zstd-safe",
+ "zstd-safe 5.0.2+zstd.1.5.2",
+]
+
+[[package]]
+name = "zstd"
+version = "0.13.3"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "e91ee311a569c327171651566e07972200e76fcfe2242a4fa446149a3881c08a"
+dependencies = [
+ "zstd-safe 7.3.0",
]
[[package]]
@@ -23455,6 +23484,15 @@ dependencies = [
"zstd-sys",
]
+[[package]]
+name = "zstd-safe"
+version = "7.3.0"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "64d80649ab6db9d9f6f9c80a40becd948eda4714a0a5ac8c4d157a32231c7882"
+dependencies = [
+ "zstd-sys",
+]
+
[[package]]
name = "zstd-sys"
version = "2.0.16+zstd.1.5.7"
diff --git a/Cargo.toml b/Cargo.toml
index 36fb3781b4b..e9d58f75607 100644
--- a/Cargo.toml
+++ b/Cargo.toml
@@ -446,7 +446,7 @@ remote_connection = { path = "crates/remote_connection" }
remote_server = { path = "crates/remote_server" }
repl = { path = "crates/repl" }
reqwest_client = { path = "crates/reqwest_client" }
-rodio = { git = "https://github.com/RustAudio/rodio", rev = "e50e726ddd0292f6ef9de0dda6b90af4ed1fb66a", features = ["wav", "playback", "wav_output", "recording"] }
+rodio = { git = "https://github.com/RustAudio/rodio", rev = "e50e726ddd0292f6ef9de0dda6b90af4ed1fb66a", default-features = false, features = ["wav", "playback", "wav_output", "recording", "dither"] }
rope = { path = "crates/rope" }
rpc = { path = "crates/rpc" }
sandbox = { path = "crates/sandbox" }
@@ -808,7 +808,7 @@ rsa = "0.9.6"
runtimelib = { version = "1.4.0", default-features = false, features = [
"async-dispatcher-runtime", "aws-lc-rs"
] }
-rust-embed = { version = "8.11", features = ["include-exclude"] }
+rust-embed = { version = "8.11", features = ["include-exclude", "compression"] }
rustc-hash = "2.1.0"
rustix = { version = "1.1", features = ["fs"] }
rustls = { version = "0.23.26" }
diff --git a/crates/util/src/util.rs b/crates/util/src/util.rs
index 529abc10da0..f79a8b6c652 100644
--- a/crates/util/src/util.rs
+++ b/crates/util/src/util.rs
@@ -713,7 +713,7 @@ pub fn dev_repo_root() -> Option<&'static std::path::Path> {
/// detail). Hidden from the public API.
#[doc(hidden)]
pub mod __rust_embed {
- pub use rust_embed::{EmbeddedFile, Filenames, Metadata, RustEmbed, utils};
+ pub use rust_embed::{EmbeddedFile, Filenames, Metadata, RustEmbed, flate, utils};
}
/// Backs the dev arm of [`fs_embed!`]'s `iter`: every file under the root-relative
diff --git a/docs/src/development/windows.md b/docs/src/development/windows.md
index b9882c51354..2b85d9a6cae 100644
--- a/docs/src/development/windows.md
+++ b/docs/src/development/windows.md
@@ -133,10 +133,10 @@ Because these settings change over time, the resulting build errors may vary fro
If you need extra Rust flags, use one of the following approaches in `.cargo/config.toml`:
-Add your flags in the build section
+Add your flags in the common target section
```toml
-[build]
+[target.'cfg(all())']
rustflags = ["-C", "symbol-mangling-version=v0", "--cfg", "tokio_unstable"]
```
diff --git a/script/bundle-linux b/script/bundle-linux
index e7525ffbddc..017fb99cc0e 100755
--- a/script/bundle-linux
+++ b/script/bundle-linux
@@ -43,6 +43,11 @@ while [[ $# -gt 0 ]]; do
esac
done
+if [[ -n "${RUSTFLAGS+x}" || -n "${CARGO_ENCODED_RUSTFLAGS+x}" ]]; then
+ echo "Unset RUSTFLAGS and CARGO_ENCODED_RUSTFLAGS; put extra flags in target rustflags in .cargo/config.toml so bundle flags are preserved." >&2
+ exit 1
+fi
+
export ZED_BUNDLE=true
channel=$(<crates/zed/RELEASE_CHANNEL)
@@ -74,20 +79,10 @@ fi
export CC=${CC:-$(which clang)}
# Build binary in release mode
-# We need lld to link libwebrtc.a successfully on aarch64-linux.
-# NOTE: Since RUSTFLAGS env var overrides all .cargo/config.toml rustflags
-# (see https://github.com/rust-lang/cargo/issues/5376), the
-# [target.aarch64-unknown-linux-gnu] section in config.toml has no effect here.
-if [[ "$(uname -m)" == "aarch64" ]]; then
- export RUSTFLAGS="${RUSTFLAGS:-} -C link-arg=-fuse-ld=lld -C link-args=-Wl,--disable-new-dtags,-rpath,\$ORIGIN/../lib"
-else
- export RUSTFLAGS="${RUSTFLAGS:-} -C link-args=-Wl,--disable-new-dtags,-rpath,\$ORIGIN/../lib"
-fi
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
- export RUSTFLAGS="${RUSTFLAGS:-} -C target-feature=+crt-static"
musl_cc_var="CC_$(echo "$remote_server_triple" | tr '-' '_')"
export "$musl_cc_var"=musl-gcc
fi
diff --git a/script/bundle-mac b/script/bundle-mac
index 4194d0f7baf..12deaa7ede1 100755
--- a/script/bundle-mac
+++ b/script/bundle-mac
@@ -33,7 +33,6 @@ do
o) open_result=true;;
d)
export CARGO_INCREMENTAL=true
- export CARGO_BUNDLE_SKIP_BUILD=true
build_flag="";
target_dir="debug"
;;
@@ -55,6 +54,7 @@ export ZED_RELEASE_CHANNEL="${channel}"
popd
export ZED_BUNDLE=true
+export CARGO_BUNDLE_SKIP_BUILD=true
cargo_bundle_version=$(cargo -q bundle --help 2>&1 | head -n 1 || echo "")
if [ "$cargo_bundle_version" != "cargo-bundle v0.6.1-zed" ]; then