-[package]
-name = "rustc_codegen_cranelift"
-version = "0.1.0"
-authors = ["bjorn3 <bjorn3@users.noreply.github.com>"]
-edition = "2018"
+[workspace]
+members = [
+ "src/bootstrap",
+ "compiler/rustc",
+ "library/std",
+ "library/test",
+ "src/tools/cargotest",
+ "src/tools/clippy",
+ "src/tools/compiletest",
+ "src/tools/error_index_generator",
+ "src/tools/linkchecker",
+ "src/tools/lint-docs",
+ "src/tools/rustbook",
+ "src/tools/unstable-book-gen",
+ "src/tools/tidy",
+ "src/tools/tier-check",
+ "src/tools/build-manifest",
+ "src/tools/remote-test-client",
+ "src/tools/remote-test-server",
+ "src/tools/rust-installer",
+ "src/tools/rust-demangler",
+ "src/tools/cargo",
+ "src/tools/cargo/crates/credential/cargo-credential-1password",
+ "src/tools/cargo/crates/credential/cargo-credential-macos-keychain",
+ "src/tools/cargo/crates/credential/cargo-credential-wincred",
+ "src/tools/rustdoc",
+ "src/tools/rls",
+ "src/tools/rustfmt",
+ "src/tools/miri",
+ "src/tools/miri/cargo-miri",
+ "src/tools/rustdoc-themes",
+ "src/tools/unicode-table-generator",
+ "src/tools/expand-yaml-anchors",
+]
-[lib]
-crate-type = ["dylib"]
+exclude = [
+ "build",
+ "compiler/rustc_codegen_cranelift",
+ # HACK(eddyb) This hardcodes the fact that our CI uses `/checkout/obj`.
+ "obj",
+ # The `x` binary is a thin wrapper that calls `x.py`, which initializes
+ # submodules, before which workspace members cannot be invoked because
+ # not all `Cargo.toml` files are available, so we exclude the `x` binary,
+ # so it can be invoked before the current checkout is set up.
+ "src/tools/x",
+]
-[dependencies]
-# These have to be in sync with each other
-cranelift-codegen = { git = "https://github.com/bytecodealliance/wasmtime/", branch = "main", features = ["unwind"] }
-cranelift-frontend = { git = "https://github.com/bytecodealliance/wasmtime/", branch = "main" }
-cranelift-module = { git = "https://github.com/bytecodealliance/wasmtime/", branch = "main" }
-cranelift-jit = { git = "https://github.com/bytecodealliance/wasmtime/", branch = "main", optional = true }
-cranelift-object = { git = "https://github.com/bytecodealliance/wasmtime/", branch = "main" }
-target-lexicon = "0.11.0"
-gimli = { version = "0.23.0", default-features = false, features = ["write"]}
-object = { version = "0.22.0", default-features = false, features = ["std", "read_core", "write", "coff", "elf", "macho", "pe"] }
+[profile.release.package.compiler_builtins]
+# The compiler-builtins crate cannot reference libcore, and it's own CI will
+# verify that this is the case. This requires, however, that the crate is built
+# without overflow checks and debug assertions. Forcefully disable debug
+# assertions and overflow checks here which should ensure that even if these
+# assertions are enabled for libstd we won't enable then for compiler_builtins
+# which should ensure we still link everything correctly.
+debug-assertions = false
+overflow-checks = false
-ar = { git = "https://github.com/bjorn3/rust-ar.git", branch = "do_not_remove_cg_clif_ranlib" }
-indexmap = "1.0.2"
-libloading = { version = "0.6.0", optional = true }
+# For compiler-builtins we always use a high number of codegen units.
+# The goal here is to place every single intrinsic into its own object
+# file to avoid symbol clashes with the system libgcc if possible. Note
+# that this number doesn't actually produce this many object files, we
+# just don't create more than this number of object files.
+#
+# It's a bit of a bummer that we have to pass this here, unfortunately.
+# Ideally this would be specified through an env var to Cargo so Cargo
+# knows how many CGUs are for this specific crate, but for now
+# per-crate configuration isn't specifiable in the environment.
+codegen-units = 10000
-# Uncomment to use local checkout of cranelift
-#[patch."https://github.com/bytecodealliance/wasmtime/"]
-#cranelift-codegen = { path = "../wasmtime/cranelift/codegen" }
-#cranelift-frontend = { path = "../wasmtime/cranelift/frontend" }
-#cranelift-module = { path = "../wasmtime/cranelift/module" }
-#cranelift-jit = { path = "../wasmtime/cranelift/jit" }
-#cranelift-object = { path = "../wasmtime/cranelift/object" }
+# These dependencies of the standard library implement symbolication for
+# backtraces on most platforms. Their debuginfo causes both linking to be slower
+# (more data to chew through) and binaries to be larger without really all that
+# much benefit. This section turns them all to down to have no debuginfo which
+# helps to improve link times a little bit.
+[profile.release.package]
+addr2line.debug = 0
+adler.debug = 0
+gimli.debug = 0
+miniz_oxide.debug = 0
+object.debug = 0
-#[patch.crates-io]
-#gimli = { path = "../" }
+# We want the RLS to use the version of Cargo that we've got vendored in this
+# repository to ensure that the same exact version of Cargo is used by both the
+# RLS and the Cargo binary itself. The RLS depends on Cargo as a git repository
+# so we use a `[patch]` here to override the github repository with our local
+# vendored copy.
+[patch."https://github.com/rust-lang/cargo"]
+cargo = { path = "src/tools/cargo" }
-[features]
-default = ["jit", "inline_asm"]
-jit = ["cranelift-jit", "libloading"]
-inline_asm = []
+[patch."https://github.com/rust-lang/rustfmt"]
+# Similar to Cargo above we want the RLS to use a vendored version of `rustfmt`
+# that we're shipping as well (to ensure that the rustfmt in RLS and the
+# `rustfmt` executable are the same exact version).
+rustfmt-nightly = { path = "src/tools/rustfmt" }
-[profile.dev]
-# By compiling dependencies with optimizations, performing tests gets much faster.
-opt-level = 3
+[patch.crates-io]
+# See comments in `src/tools/rustc-workspace-hack/README.md` for what's going on
+# here
+rustc-workspace-hack = { path = 'src/tools/rustc-workspace-hack' }
-[profile.dev.package.rustc_codegen_cranelift]
-# Disabling optimizations for cg_clif itself makes compilation after a change faster.
-opt-level = 0
+# See comments in `library/rustc-std-workspace-core/README.md` for what's going on
+# here
+rustc-std-workspace-core = { path = 'library/rustc-std-workspace-core' }
+rustc-std-workspace-alloc = { path = 'library/rustc-std-workspace-alloc' }
+rustc-std-workspace-std = { path = 'library/rustc-std-workspace-std' }
-[profile.release.package.rustc_codegen_cranelift]
-incremental = true
+# This crate's integration with libstd is a bit wonky, so we use a submodule
+# instead of a crates.io dependency. Make sure everything else in the repo is
+# also using the submodule, however, so we can avoid duplicate copies of the
+# source code for this crate.
+backtrace = { path = "library/backtrace" }
-# Disable optimizations and debuginfo of build scripts and some of the heavy build deps, as the
-# execution time of build scripts is so fast that optimizing them slows down the total build time.
-[profile.dev.build-override]
-opt-level = 0
-debug = false
-
-[profile.release.build-override]
-opt-level = 0
-debug = false
-
-[profile.dev.package.cranelift-codegen-meta]
-opt-level = 0
-debug = false
-
-[profile.release.package.cranelift-codegen-meta]
-opt-level = 0
-debug = false
-
-[profile.dev.package.syn]
-opt-level = 0
-debug = false
-
-[profile.release.package.syn]
-opt-level = 0
-debug = false
+[patch."https://github.com/rust-lang/rust-clippy"]
+clippy_lints = { path = "src/tools/clippy/clippy_lints" }