Skip to content

Commit 1f50aac

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 1f50aac

File tree

6 files changed

+24
-24
lines changed

6 files changed

+24
-24
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 }

src/bootstrap/src/core/builder/tests.rs

Lines changed: 11 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -999,7 +999,7 @@ mod snapshot {
999999
[build] llvm <host>
10001000
[build] rustc 0 <host> -> rustc 1 <host>
10011001
[build] rustdoc 0 <host>
1002-
[doc] std 1 <host> crates=[alloc,compiler_builtins,core,panic_abort,panic_unwind,proc_macro,std,std_detect,sysroot,test,unwind]
1002+
[doc] std 1 <host> crates=[alloc,compiler_builtins,core,panic_abort,panic_unwind,proc_macro,rustc-std-workspace-core,std,std_detect,sysroot,test,unwind]
10031003
");
10041004
}
10051005

@@ -1048,7 +1048,7 @@ mod snapshot {
10481048
[build] rustc 1 <host> -> std 1 <host>
10491049
[build] rustc 1 <host> -> rustc 2 <host>
10501050
[build] rustdoc 1 <host>
1051-
[doc] std 2 <host> crates=[alloc,compiler_builtins,core,panic_abort,panic_unwind,proc_macro,std,std_detect,sysroot,test,unwind]
1051+
[doc] std 2 <host> crates=[alloc,compiler_builtins,core,panic_abort,panic_unwind,proc_macro,rustc-std-workspace-core,std,std_detect,sysroot,test,unwind]
10521052
[build] rustc 2 <host> -> std 2 <host>
10531053
[build] rustc 0 <host> -> LintDocs 1 <host>
10541054
[build] rustc 0 <host> -> RustInstaller 1 <host>
@@ -1090,7 +1090,7 @@ mod snapshot {
10901090
[build] rustc 1 <host> -> WasmComponentLd 2 <host>
10911091
[build] rustc 1 <host> -> LlvmBitcodeLinker 2 <host>
10921092
[build] rustdoc 1 <host>
1093-
[doc] std 2 <host> crates=[alloc,compiler_builtins,core,panic_abort,panic_unwind,proc_macro,std,std_detect,sysroot,test,unwind]
1093+
[doc] std 2 <host> crates=[alloc,compiler_builtins,core,panic_abort,panic_unwind,proc_macro,rustc-std-workspace-core,std,std_detect,sysroot,test,unwind]
10941094
[build] rustc 2 <host> -> std 2 <host>
10951095
[build] rustc 0 <host> -> LintDocs 1 <host>
10961096
[build] rustc 0 <host> -> RustInstaller 1 <host>
@@ -1126,8 +1126,8 @@ mod snapshot {
11261126
[build] rustc 1 <host> -> std 1 <host>
11271127
[build] rustc 1 <host> -> rustc 2 <host>
11281128
[build] rustdoc 1 <host>
1129-
[doc] std 2 <host> crates=[alloc,compiler_builtins,core,panic_abort,panic_unwind,proc_macro,std,std_detect,sysroot,test,unwind]
1130-
[doc] std 2 <target1> crates=[alloc,compiler_builtins,core,panic_abort,panic_unwind,proc_macro,std,std_detect,sysroot,test,unwind]
1129+
[doc] std 2 <host> crates=[alloc,compiler_builtins,core,panic_abort,panic_unwind,proc_macro,rustc-std-workspace-core,std,std_detect,sysroot,test,unwind]
1130+
[doc] std 2 <target1> crates=[alloc,compiler_builtins,core,panic_abort,panic_unwind,proc_macro,rustc-std-workspace-core,std,std_detect,sysroot,test,unwind]
11311131
[build] rustc 2 <host> -> std 2 <host>
11321132
[build] rustc 0 <host> -> LintDocs 1 <host>
11331133
[build] rustc 0 <host> -> RustInstaller 1 <host>
@@ -1163,7 +1163,7 @@ mod snapshot {
11631163
[build] rustc 1 <host> -> std 1 <host>
11641164
[build] rustc 1 <host> -> rustc 2 <host>
11651165
[build] rustdoc 1 <host>
1166-
[doc] std 2 <host> crates=[alloc,compiler_builtins,core,panic_abort,panic_unwind,proc_macro,std,std_detect,sysroot,test,unwind]
1166+
[doc] std 2 <host> crates=[alloc,compiler_builtins,core,panic_abort,panic_unwind,proc_macro,rustc-std-workspace-core,std,std_detect,sysroot,test,unwind]
11671167
[build] rustc 2 <host> -> std 2 <host>
11681168
[build] rustc 0 <host> -> LintDocs 1 <host>
11691169
[build] rustc 1 <host> -> std 1 <target1>
@@ -1200,8 +1200,8 @@ mod snapshot {
12001200
[build] rustc 1 <host> -> std 1 <host>
12011201
[build] rustc 1 <host> -> rustc 2 <host>
12021202
[build] rustdoc 1 <host>
1203-
[doc] std 2 <host> crates=[alloc,compiler_builtins,core,panic_abort,panic_unwind,proc_macro,std,std_detect,sysroot,test,unwind]
1204-
[doc] std 2 <target1> crates=[alloc,compiler_builtins,core,panic_abort,panic_unwind,proc_macro,std,std_detect,sysroot,test,unwind]
1203+
[doc] std 2 <host> crates=[alloc,compiler_builtins,core,panic_abort,panic_unwind,proc_macro,rustc-std-workspace-core,std,std_detect,sysroot,test,unwind]
1204+
[doc] std 2 <target1> crates=[alloc,compiler_builtins,core,panic_abort,panic_unwind,proc_macro,rustc-std-workspace-core,std,std_detect,sysroot,test,unwind]
12051205
[build] rustc 2 <host> -> std 2 <host>
12061206
[build] rustc 0 <host> -> LintDocs 1 <host>
12071207
[build] rustc 1 <host> -> std 1 <target1>
@@ -1242,7 +1242,7 @@ mod snapshot {
12421242
[build] rustc 1 <host> -> std 1 <host>
12431243
[build] rustc 1 <host> -> rustc 2 <host>
12441244
[build] rustdoc 1 <host>
1245-
[doc] std 2 <target1> crates=[alloc,compiler_builtins,core,panic_abort,panic_unwind,proc_macro,std,std_detect,sysroot,test,unwind]
1245+
[doc] std 2 <target1> crates=[alloc,compiler_builtins,core,panic_abort,panic_unwind,proc_macro,rustc-std-workspace-core,std,std_detect,sysroot,test,unwind]
12461246
[build] rustc 2 <host> -> std 2 <host>
12471247
[build] rustc 0 <host> -> RustInstaller 1 <host>
12481248
[dist] docs <target1>
@@ -1274,7 +1274,7 @@ mod snapshot {
12741274
[build] rustc 1 <host> -> rustc 2 <host>
12751275
[build] rustc 1 <host> -> WasmComponentLd 2 <host>
12761276
[build] rustdoc 1 <host>
1277-
[doc] std 2 <target1> crates=[alloc,compiler_builtins,core,panic_abort,panic_unwind,proc_macro,std,std_detect,sysroot,test,unwind]
1277+
[doc] std 2 <target1> crates=[alloc,compiler_builtins,core,panic_abort,panic_unwind,proc_macro,rustc-std-workspace-core,std,std_detect,sysroot,test,unwind]
12781278
[build] rustc 2 <host> -> std 2 <host>
12791279
[build] rustc 1 <host> -> std 1 <target1>
12801280
[build] rustc 2 <host> -> std 2 <target1>
@@ -1620,7 +1620,7 @@ mod snapshot {
16201620
[build] llvm <host>
16211621
[build] rustc 0 <host> -> rustc 1 <host>
16221622
[build] rustdoc 0 <host>
1623-
[doc] std 1 <host> crates=[alloc,compiler_builtins,core,panic_abort,panic_unwind,proc_macro,std,std_detect,sysroot,test,unwind]
1623+
[doc] std 1 <host> crates=[alloc,compiler_builtins,core,panic_abort,panic_unwind,proc_macro,rustc-std-workspace-core,std,std_detect,sysroot,test,unwind]
16241624
");
16251625
}
16261626

0 commit comments

Comments
 (0)