summaryrefslogtreecommitdiffstats
path: root/library/rustc-std-workspace-core
diff options
context:
space:
mode:
authorDaniel Baumann <daniel.baumann@progress-linux.org>2024-04-17 12:02:58 +0000
committerDaniel Baumann <daniel.baumann@progress-linux.org>2024-04-17 12:02:58 +0000
commit698f8c2f01ea549d77d7dc3338a12e04c11057b9 (patch)
tree173a775858bd501c378080a10dca74132f05bc50 /library/rustc-std-workspace-core
parentInitial commit. (diff)
downloadrustc-698f8c2f01ea549d77d7dc3338a12e04c11057b9.tar.xz
rustc-698f8c2f01ea549d77d7dc3338a12e04c11057b9.zip
Adding upstream version 1.64.0+dfsg1.upstream/1.64.0+dfsg1
Signed-off-by: Daniel Baumann <daniel.baumann@progress-linux.org>
Diffstat (limited to 'library/rustc-std-workspace-core')
-rw-r--r--library/rustc-std-workspace-core/Cargo.toml14
-rw-r--r--library/rustc-std-workspace-core/README.md29
-rw-r--r--library/rustc-std-workspace-core/lib.rs4
3 files changed, 47 insertions, 0 deletions
diff --git a/library/rustc-std-workspace-core/Cargo.toml b/library/rustc-std-workspace-core/Cargo.toml
new file mode 100644
index 000000000..ff5cfcbd6
--- /dev/null
+++ b/library/rustc-std-workspace-core/Cargo.toml
@@ -0,0 +1,14 @@
+[package]
+name = "rustc-std-workspace-core"
+version = "1.99.0"
+license = 'MIT OR Apache-2.0'
+description = """
+Hack for the compiler's own build system
+"""
+edition = "2021"
+
+[lib]
+path = "lib.rs"
+
+[dependencies]
+core = { path = "../core" }
diff --git a/library/rustc-std-workspace-core/README.md b/library/rustc-std-workspace-core/README.md
new file mode 100644
index 000000000..40e0b62af
--- /dev/null
+++ b/library/rustc-std-workspace-core/README.md
@@ -0,0 +1,29 @@
+# The `rustc-std-workspace-core` crate
+
+This crate is a shim and empty crate which simply depends on `libcore` and
+reexports all of its contents. The crate is the crux of empowering the standard
+library to depend on crates from crates.io
+
+Crates on crates.io that the standard library depend on need to depend on the
+`rustc-std-workspace-core` crate from crates.io, which is empty. We use
+`[patch]` to override it to this crate in this repository. As a result, crates
+on crates.io will draw a dependency edge to `libcore`, the version defined in
+this repository. That should draw all the dependency edges to ensure Cargo
+builds crates successfully!
+
+Note that crates on crates.io need to depend on this crate with the name `core`
+for everything to work correctly. To do that they can use:
+
+```toml
+core = { version = "1.0.0", optional = true, package = 'rustc-std-workspace-core' }
+```
+
+Through the use of the `package` key the crate is renamed to `core`, meaning
+it'll look like
+
+```
+--extern core=.../librustc_std_workspace_core-XXXXXXX.rlib
+```
+
+when Cargo invokes the compiler, satisfying the implicit `extern crate core`
+directive injected by the compiler.
diff --git a/library/rustc-std-workspace-core/lib.rs b/library/rustc-std-workspace-core/lib.rs
new file mode 100644
index 000000000..143278525
--- /dev/null
+++ b/library/rustc-std-workspace-core/lib.rs
@@ -0,0 +1,4 @@
+#![feature(no_core)]
+#![no_core]
+
+pub use core::*;