Skip to content

Commit c106135

Browse files
Auto merge of #141993 - tgross35:use-in-tree-builtins, r=<try>
Use the in-tree `compiler-builtins` for the sysroot 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. Zulip discussion: [#t-compiler > Using in-tree compiler-builtins](https://rust-lang.zulipchat.com/#narrow/channel/131828-t-compiler/topic/Using.20in-tree.20compiler-builtins/with/522445336) Once this merges, the following PRs will need to make it to a release for the relevant crates: - rust-lang/getopts#119 (can merge at any time) - rust-lang/hashbrown#625 (can merge at any time) - rust-lang/stdarch#1825 - rust-lang/rustc-demangle#80 - rust-lang/cfg-if#84 - unicode-rs/unicode-width#77 The above should cover all tier 1 targets. The remaining cover the rest: - `dlmalloc` (wasm, xous, sgx) alexcrichton/dlmalloc-rs#50 - `gimli` (xous) - `r-efi`, `r-efi-alloc` (efi) - `fortanix-sgx-abi` (sgx) - `hermit-abi` (hermit) - `wasi` (wasi) try-job: dist-x86_64-linux try-job: x86_64-gnu try-job: x86_64-gnu-aux try-job: test-various
2 parents 076ec59 + 6609ade commit c106135

File tree

16 files changed

+29
-24
lines changed

16 files changed

+29
-24
lines changed

Cargo.lock

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -701,7 +701,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index"
701701
checksum = "117725a109d387c937a1533ce01b450cbde6b88abceea8473c4d7a85853cda3c"
702702
dependencies = [
703703
"lazy_static",
704-
"windows-sys 0.59.0",
704+
"windows-sys 0.48.0",
705705
]
706706

707707
[[package]]
@@ -1147,7 +1147,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index"
11471147
checksum = "976dd42dc7e85965fe702eb8164f21f450704bdde31faefd6471dba214cb594e"
11481148
dependencies = [
11491149
"libc",
1150-
"windows-sys 0.59.0",
1150+
"windows-sys 0.52.0",
11511151
]
11521152

11531153
[[package]]
@@ -3119,10 +3119,10 @@ dependencies = [
31193119
[[package]]
31203120
name = "rustc-build-sysroot"
31213121
version = "0.5.7"
3122-
source = "registry+https://github.com/rust-lang/crates.io-index"
3123-
checksum = "10edc2e4393515193bd766e2f6c050b0536a68e56f2b6d56c07ababfdc114ff0"
3122+
source = "git+https://github.com/tgross35/rustc-build-sysroot?branch=patch-compiler-builtins#4793aabe776bdfb736558fcea91054af22751997"
31243123
dependencies = [
31253124
"anyhow",
3125+
"regex",
31263126
"rustc_version",
31273127
"tempfile",
31283128
"walkdir",
@@ -4749,7 +4749,7 @@ dependencies = [
47494749
"errno",
47504750
"libc",
47514751
"linux-raw-sys",
4752-
"windows-sys 0.59.0",
4752+
"windows-sys 0.52.0",
47534753
]
47544754

47554755
[[package]]
@@ -4995,7 +4995,7 @@ dependencies = [
49954995
"cfg-if",
49964996
"libc",
49974997
"psm",
4998-
"windows-sys 0.59.0",
4998+
"windows-sys 0.52.0",
49994999
]
50005000

50015001
[[package]]
@@ -5138,7 +5138,7 @@ dependencies = [
51385138
"getrandom 0.3.3",
51395139
"once_cell",
51405140
"rustix",
5141-
"windows-sys 0.59.0",
5141+
"windows-sys 0.52.0",
51425142
]
51435143

51445144
[[package]]
@@ -5995,7 +5995,7 @@ version = "0.1.9"
59955995
source = "registry+https://github.com/rust-lang/crates.io-index"
59965996
checksum = "cf221c93e13a30d793f7645a0e7762c55d169dbb0a49671918a2319d289b10bb"
59975997
dependencies = [
5998-
"windows-sys 0.59.0",
5998+
"windows-sys 0.48.0",
59995999
]
60006000

60016001
[[package]]

compiler/rustc_codegen_gcc/build_system/build_sysroot/Cargo.toml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,6 @@ resolver = "2"
66

77
[dependencies]
88
core = { path = "./sysroot_src/library/core" }
9-
compiler_builtins = "0.1"
109
alloc = { path = "./sysroot_src/library/alloc" }
1110
std = { path = "./sysroot_src/library/std", features = ["panic_unwind", "backtrace"] }
1211
test = { path = "./sysroot_src/library/test" }
@@ -16,6 +15,7 @@ proc_macro = { path = "./sysroot_src/library/proc_macro" }
1615
rustc-std-workspace-core = { path = "./sysroot_src/library/rustc-std-workspace-core" }
1716
rustc-std-workspace-alloc = { path = "./sysroot_src/library/rustc-std-workspace-alloc" }
1817
rustc-std-workspace-std = { path = "./sysroot_src/library/rustc-std-workspace-std" }
18+
compiler_builtins = { path = "./sysroot_src/library/compiler-builtins/compiler-builtins" }
1919

2020
# For compiler-builtins we always use a high number of codegen units.
2121
# The goal here is to place every single intrinsic into its own object

library/Cargo.lock

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -62,11 +62,9 @@ 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",
7068
]
7169

7270
[[package]]
@@ -304,6 +302,7 @@ dependencies = [
304302
name = "rustc-std-workspace-core"
305303
version = "1.99.0"
306304
dependencies = [
305+
"compiler_builtins",
307306
"core",
308307
]
309308

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: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -17,9 +17,7 @@ doctest = false
1717
test = false
1818

1919
[dependencies]
20-
# For more information on this dependency see
21-
# https://github.com/rust-lang/rust/tree/master/library/rustc-std-workspace-core
22-
core = { version = "1.0.1", optional = true, package = "rustc-std-workspace-core" }
20+
core = { path = "../../core", optional = true }
2321

2422
[build-dependencies]
2523
cc = { optional = true, version = "1.2" }

library/compiler-builtins/compiler-builtins/src/aarch64_linux.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@
44
//! To avoid breaking backwards compat, C toolchains introduced a concept of "outlined atomics",
55
//! where atomic operations call into the compiler runtime to dispatch between two depending on
66
//! which is supported on the current CPU.
7-
//! See https://community.arm.com/arm-community-blogs/b/tools-software-ides-blog/posts/making-the-most-of-the-arm-architecture-in-gcc-10#:~:text=out%20of%20line%20atomics for more discussion.
7+
//! See <https://community.arm.com/arm-community-blogs/b/tools-software-ides-blog/posts/making-the-most-of-the-arm-architecture-in-gcc-10#:~:text=out%20of%20line%20atomics> for more discussion.
88
//!
99
//! Currently we only support LL/SC, because LSE requires `getauxval` from libc in order to do runtime detection.
1010
//! Use the `compiler-rt` intrinsics if you want LSE support.

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"] }

0 commit comments

Comments
 (0)