Skip to content
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.

Commit 22e026b

Browse files
committedAug 4, 2024
Auto merge of rust-lang#128534 - bjorn3:split_stdlib_workspace, r=Mark-Simulacrum
Move the standard library to a separate workspace This ensures that the Cargo.lock packaged for it in the rust-src component is up-to-date, allowing rust-analyzer to run cargo metadata on the standard library even when the rust-src component is stored in a read-only location as is necessary for loading crates.io dependencies of the standard library. This also simplifies tidy's license check for runtime dependencies as it can now look at all entries in library/Cargo.lock without having to filter for just the dependencies of runtime crates. In addition this allows removing an exception in check_runtime_license_exceptions that was necessary due to the compiler enabling a feature on the object crate which pulls in a dependency not allowed for the standard library. While cargo workspaces normally enable dependencies of multiple targets to be reused, for the standard library we do not want this reusing to prevent conflicts between dependencies of the sysroot and of tools that are built using this sysroot. For this reason we already use an unstable cargo feature to ensure that any dependencies which would otherwise be shared get a different -Cmetadata argument as well as using separate build dirs. This doesn't change the situation around vendoring. We already have several cargo workspaces that need to be vendored. Adding another one doesn't change much. There are also no cargo profiles that are shared between the root workspace and the library workspace anyway, so it doesn't add any extra work when changing cargo profiles.
2 parents 1813603 + 9fa74ab commit 22e026b

File tree

2 files changed

+533
-0
lines changed

2 files changed

+533
-0
lines changed
 

‎Cargo.lock

Lines changed: 489 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

‎Cargo.toml

Lines changed: 44 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,44 @@
1+
[workspace]
2+
resolver = "1"
3+
members = [
4+
"std",
5+
"sysroot",
6+
]
7+
8+
exclude = [
9+
# stdarch has its own Cargo workspace
10+
"stdarch",
11+
]
12+
13+
[profile.release.package.compiler_builtins]
14+
# For compiler-builtins we always use a high number of codegen units.
15+
# The goal here is to place every single intrinsic into its own object
16+
# file to avoid symbol clashes with the system libgcc if possible. Note
17+
# that this number doesn't actually produce this many object files, we
18+
# just don't create more than this number of object files.
19+
#
20+
# It's a bit of a bummer that we have to pass this here, unfortunately.
21+
# Ideally this would be specified through an env var to Cargo so Cargo
22+
# knows how many CGUs are for this specific crate, but for now
23+
# per-crate configuration isn't specifiable in the environment.
24+
codegen-units = 10000
25+
26+
# These dependencies of the standard library implement symbolication for
27+
# backtraces on most platforms. Their debuginfo causes both linking to be slower
28+
# (more data to chew through) and binaries to be larger without really all that
29+
# much benefit. This section turns them all to down to have no debuginfo which
30+
# helps to improve link times a little bit.
31+
[profile.release.package]
32+
addr2line.debug = 0
33+
adler.debug = 0
34+
gimli.debug = 0
35+
miniz_oxide.debug = 0
36+
object.debug = 0
37+
rustc-demangle.debug = 0
38+
39+
[patch.crates-io]
40+
# See comments in `library/rustc-std-workspace-core/README.md` for what's going on
41+
# here
42+
rustc-std-workspace-core = { path = 'rustc-std-workspace-core' }
43+
rustc-std-workspace-alloc = { path = 'rustc-std-workspace-alloc' }
44+
rustc-std-workspace-std = { path = 'rustc-std-workspace-std' }

0 commit comments

Comments
 (0)
Please sign in to comment.