Skip to content

Commit 3c91330

Browse files
committed
Use the in-tree compiler-builtins
Many of `std`'s dependency have a dependency on the crates.io `compiler-builtins` when used with the feature `rustc-std-workspace-core`. Use a Cargo patch to select the in-tree version instead. `compiler-builtins` is also added as a dependency of `rustc-std-workspace-core` so these crates can remove their crates.io dependency in the future.
1 parent 59aa1e8 commit 3c91330

File tree

11 files changed

+26
-16
lines changed

11 files changed

+26
-16
lines changed

library/Cargo.lock

Lines changed: 7 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -62,11 +62,10 @@ dependencies = [
6262
[[package]]
6363
name = "compiler_builtins"
6464
version = "0.1.160"
65-
source = "registry+https://github.com/rust-lang/crates.io-index"
66-
checksum = "6376049cfa92c0aa8b9ac95fae22184b981c658208d4ed8a1dc553cd83612895"
6765
dependencies = [
6866
"cc",
69-
"rustc-std-workspace-core",
67+
"core",
68+
"panic-handler",
7069
]
7170

7271
[[package]]
@@ -191,6 +190,10 @@ dependencies = [
191190
"rustc-std-workspace-core",
192191
]
193192

193+
[[package]]
194+
name = "panic-handler"
195+
version = "0.1.0"
196+
194197
[[package]]
195198
name = "panic_abort"
196199
version = "0.0.0"
@@ -304,6 +307,7 @@ dependencies = [
304307
name = "rustc-std-workspace-core"
305308
version = "1.99.0"
306309
dependencies = [
310+
"compiler_builtins",
307311
"core",
308312
]
309313

library/Cargo.toml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -50,3 +50,4 @@ rustc-demangle.opt-level = "s"
5050
rustc-std-workspace-core = { path = 'rustc-std-workspace-core' }
5151
rustc-std-workspace-alloc = { path = 'rustc-std-workspace-alloc' }
5252
rustc-std-workspace-std = { path = 'rustc-std-workspace-std' }
53+
compiler_builtins = { path = "compiler-builtins/compiler-builtins" }

library/alloc/Cargo.toml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@ bench = false
1616

1717
[dependencies]
1818
core = { path = "../core", public = true }
19-
compiler_builtins = { version = "=0.1.160", features = ['rustc-dep-of-std'] }
19+
compiler_builtins = { path = "../compiler-builtins/compiler-builtins", features = ["rustc-dep-of-std"] }
2020

2121
[features]
2222
compiler-builtins-mem = ['compiler_builtins/mem']

library/compiler-builtins/compiler-builtins/Cargo.toml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
[package]
22
authors = ["Jorge Aparicio <japaricious@gmail.com>"]
33
name = "compiler_builtins"
4-
version = "0.1.159"
4+
version = "0.1.160"
55
license = "MIT AND Apache-2.0 WITH LLVM-exception AND (MIT OR Apache-2.0)"
66
readme = "README.md"
77
repository = "https://github.com/rust-lang/compiler-builtins"
@@ -19,7 +19,7 @@ test = false
1919
[dependencies]
2020
# For more information on this dependency see
2121
# https://github.com/rust-lang/rust/tree/master/library/rustc-std-workspace-core
22-
core = { version = "1.0.0", optional = true, package = "rustc-std-workspace-core" }
22+
core = { path = "../../core", optional = true }
2323

2424
[build-dependencies]
2525
cc = { optional = true, version = "1.0" }
Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,11 @@
1-
//! This is needed for tests on targets that require a `#[panic_handler]` function
1+
// //! This is needed for tests on targets that require a `#[panic_handler]` function
22

33
#![feature(no_core)]
44
#![no_core]
55

6-
extern crate core;
6+
// extern crate core;
77

8-
#[panic_handler]
9-
fn panic(_: &core::panic::PanicInfo) -> ! {
10-
loop {}
11-
}
8+
// #[panic_handler]
9+
// fn panic(_: &core::panic::PanicInfo) -> ! {
10+
// loop {}
11+
// }

library/panic_abort/Cargo.toml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@ doc = false
1313

1414
[dependencies]
1515
core = { path = "../core" }
16-
compiler_builtins = "0.1.0"
16+
compiler_builtins = { path = "../compiler-builtins/compiler-builtins" }
1717

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

library/panic_unwind/Cargo.toml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@ doc = false
1515
alloc = { path = "../alloc" }
1616
core = { path = "../core" }
1717
unwind = { path = "../unwind" }
18-
compiler_builtins = "0.1.0"
18+
compiler_builtins = { path = "../compiler-builtins/compiler-builtins" }
1919
cfg-if = { version = "1.0", features = ['rustc-dep-of-std'] }
2020

2121
[target.'cfg(not(all(windows, target_env = "msvc")))'.dependencies]

library/rustc-std-workspace-core/Cargo.toml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -12,3 +12,4 @@ path = "lib.rs"
1212

1313
[dependencies]
1414
core = { path = "../core" }
15+
compiler_builtins = { path = "../compiler-builtins/compiler-builtins", features = ["compiler-builtins"] }

library/rustc-std-workspace-core/lib.rs

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,3 +2,7 @@
22
#![no_core]
33

44
pub use core::*;
5+
6+
// Crate must be brought into scope so it appears in the crate graph for anything that
7+
// depends on `rustc-std-workspace-core`.
8+
use compiler_builtins as _;

library/std/Cargo.toml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,7 @@ cfg-if = { version = "1.0", features = ['rustc-dep-of-std'] }
1818
panic_unwind = { path = "../panic_unwind", optional = true }
1919
panic_abort = { path = "../panic_abort" }
2020
core = { path = "../core", public = true }
21-
compiler_builtins = { version = "=0.1.160" }
21+
compiler_builtins = { path = "../compiler-builtins/compiler-builtins" }
2222
unwind = { path = "../unwind" }
2323
hashbrown = { version = "0.15", default-features = false, features = [
2424
'rustc-dep-of-std',

library/unwind/Cargo.toml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@ doc = false
1515

1616
[dependencies]
1717
core = { path = "../core" }
18-
compiler_builtins = "0.1.0"
18+
compiler_builtins = { path = "../compiler-builtins/compiler-builtins" }
1919
cfg-if = "1.0"
2020

2121
[target.'cfg(not(all(windows, target_env = "msvc")))'.dependencies]

0 commit comments

Comments
 (0)