Skip to content

Commit 0628a65

Browse files
committed
Use core via rustc-std-workspace-core in library/panic*
The three panic-related library crates need to have access to `core`, and `compiler-builtins` needs to be in the crate graph. Rather than specifying both dependencies, switch these crates to use `rustc-std-workspace-core` which already does this. This means there is now a single place that the `compiler-builtins` dependency needs to get configured, for everything other than `alloc` and `std`.
1 parent e5e79f8 commit 0628a65

File tree

5 files changed

+13
-13
lines changed

5 files changed

+13
-13
lines changed

library/Cargo.lock

Lines changed: 3 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -183,9 +183,8 @@ name = "panic_abort"
183183
version = "0.0.0"
184184
dependencies = [
185185
"alloc",
186-
"compiler_builtins",
187-
"core",
188186
"libc",
187+
"rustc-std-workspace-core",
189188
]
190189

191190
[[package]]
@@ -194,9 +193,8 @@ version = "0.0.0"
194193
dependencies = [
195194
"alloc",
196195
"cfg-if",
197-
"compiler_builtins",
198-
"core",
199196
"libc",
197+
"rustc-std-workspace-core",
200198
"unwind",
201199
]
202200

@@ -380,9 +378,8 @@ name = "unwind"
380378
version = "0.0.0"
381379
dependencies = [
382380
"cfg-if",
383-
"compiler_builtins",
384-
"core",
385381
"libc",
382+
"rustc-std-workspace-core",
386383
"unwinding",
387384
]
388385

library/panic_abort/Cargo.toml

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -12,8 +12,7 @@ bench = false
1212
doc = false
1313

1414
[dependencies]
15-
core = { path = "../core" }
16-
compiler_builtins = { path = "../compiler-builtins/compiler-builtins" }
15+
core = { path = "../rustc-std-workspace-core", package = "rustc-std-workspace-core" }
1716

1817
[target.'cfg(target_os = "android")'.dependencies]
1918
libc = { version = "0.2", default-features = false }

library/panic_unwind/Cargo.toml

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -13,10 +13,9 @@ doc = false
1313

1414
[dependencies]
1515
alloc = { path = "../alloc" }
16-
core = { path = "../core" }
17-
unwind = { path = "../unwind" }
18-
compiler_builtins = { path = "../compiler-builtins/compiler-builtins" }
1916
cfg-if = { version = "1.0", features = ['rustc-dep-of-std'] }
17+
core = { path = "../rustc-std-workspace-core", package = "rustc-std-workspace-core" }
18+
unwind = { path = "../unwind" }
2019

2120
[target.'cfg(not(all(windows, target_env = "msvc")))'.dependencies]
2221
libc = { version = "0.2", default-features = false }

library/rustc-std-workspace-core/README.md

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,12 @@ on crates.io will draw a dependency edge to `libcore`, the version defined in
1111
this repository. That should draw all the dependency edges to ensure Cargo
1212
builds crates successfully!
1313

14+
`rustc-std-workspace-core` also ensures `compiler-builtins` is in the crate
15+
graph. This crate is used by other crates in `library/`, other than `std` and
16+
`alloc`, so the `compiler-builtins` setup only needs to be configured in a
17+
single place. (Otherwise these crates would just need to depend on `core` and
18+
`compiler-builtins` separately.)
19+
1420
Note that crates on crates.io need to depend on this crate with the name `core`
1521
for everything to work correctly. To do that they can use:
1622

library/unwind/Cargo.toml

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -14,9 +14,8 @@ bench = false
1414
doc = false
1515

1616
[dependencies]
17-
core = { path = "../core" }
18-
compiler_builtins = { path = "../compiler-builtins/compiler-builtins" }
1917
cfg-if = "1.0"
18+
core = { path = "../rustc-std-workspace-core", package = "rustc-std-workspace-core" }
2019

2120
[target.'cfg(not(all(windows, target_env = "msvc")))'.dependencies]
2221
libc = { version = "0.2.140", features = ['rustc-dep-of-std'], default-features = false }

0 commit comments

Comments
 (0)