Skip to content

Commit 3f9f20f

Browse files
committed
Auto merge of #144154 - tgross35:update-builtins, r=tgross35
compiler-builtins subtree update Subtree update of `compiler-builtins` to rust-lang/compiler-builtins@2cdde03. Created using https://github.com/rust-lang/josh-sync. Fixes: #144076 r? `@ghost`
2 parents 6781992 + 3f04631 commit 3f9f20f

File tree

17 files changed

+55
-476
lines changed

17 files changed

+55
-476
lines changed
Lines changed: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,23 @@
1+
# Perform a subtree sync (pull) using the josh-sync tool once every few days (or on demand).
2+
name: rustc-pull
3+
4+
on:
5+
workflow_dispatch:
6+
schedule:
7+
# Run at 04:00 UTC every Monday and Thursday
8+
- cron: '0 4 * * 1,4'
9+
10+
jobs:
11+
pull:
12+
if: github.repository == 'rust-lang/compiler-builtins'
13+
uses: rust-lang/josh-sync/.github/workflows/rustc-pull.yml@main
14+
with:
15+
# https://rust-lang.zulipchat.com/#narrow/channel/219381-t-libs/topic/compiler-builtins.20subtree.20sync.20automation/with/528482375
16+
zulip-stream-id: 219381
17+
zulip-topic: 'compiler-builtins subtree sync automation'
18+
zulip-bot-email: "[email protected]"
19+
pr-base-branch: master
20+
branch-name: rustc-pull
21+
secrets:
22+
zulip-api-token: ${{ secrets.ZULIP_API_TOKEN }}
23+
token: ${{ secrets.GITHUB_TOKEN }}

library/compiler-builtins/CONTRIBUTING.md

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -165,3 +165,12 @@ cargo bench --no-default-features \
165165

166166
[`iai-callgrind-runner`]: https://crates.io/crates/iai-callgrind-runner
167167
[Valgrind]: https://valgrind.org/
168+
169+
## Subtree synchronization
170+
171+
`compiler-builtins` is included as a [Josh subtree] in the main compiler
172+
repository (`rust-lang/rust`). You can find a guide on how to create synchronization
173+
(pull and push) PRs at the [`rustc-dev-guide` page].
174+
175+
[Josh subtree]: https://rustc-dev-guide.rust-lang.org/external-repos.html#josh-subtrees
176+
[`rustc-dev-guide` page]: https://rustc-dev-guide.rust-lang.org/external-repos.html#synchronizing-a-josh-subtree

library/compiler-builtins/Cargo.toml

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,6 @@ resolver = "2"
33
members = [
44
"builtins-shim",
55
"builtins-test",
6-
"crates/josh-sync",
76
"crates/libm-macros",
87
"crates/musl-math-sys",
98
"crates/panic-handler",

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

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -12,9 +12,9 @@ license = "MIT AND Apache-2.0 WITH LLVM-exception AND (MIT OR Apache-2.0)"
1212
# `xoshiro128**` is used for its quality, size, and speed at generating `u32` shift amounts.
1313
rand_xoshiro = "0.7"
1414
# To compare float builtins against
15-
rustc_apfloat = "0.2.2"
15+
rustc_apfloat = "0.2.3"
1616
# Really a dev dependency, but dev dependencies can't be optional
17-
iai-callgrind = { version = "0.14.1", optional = true }
17+
iai-callgrind = { version = "0.15.2", optional = true }
1818

1919
[dependencies.compiler_builtins]
2020
path = "../builtins-shim"

library/compiler-builtins/ci/bench-icount.sh

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -28,7 +28,7 @@ function run_icount_benchmarks() {
2828

2929
iai_args=(
3030
"--home" "$(pwd)/$iai_home"
31-
"--regression=ir=5.0"
31+
"--callgrind-limits=ir=5.0"
3232
"--save-summary"
3333
)
3434

library/compiler-builtins/compiler-builtins/src/mem/impls.rs

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,7 @@
1515
// this use. Of course this is not a guarantee that such use will work, it just means that this
1616
// crate doing wrapping pointer arithmetic with a method that must not wrap won't be the problem if
1717
// something does go wrong at runtime.
18+
use core::ffi::c_int;
1819
use core::intrinsics::likely;
1920

2021
const WORD_SIZE: usize = core::mem::size_of::<usize>();
@@ -384,13 +385,13 @@ pub unsafe fn set_bytes(mut s: *mut u8, c: u8, mut n: usize) {
384385
}
385386

386387
#[inline(always)]
387-
pub unsafe fn compare_bytes(s1: *const u8, s2: *const u8, n: usize) -> i32 {
388+
pub unsafe fn compare_bytes(s1: *const u8, s2: *const u8, n: usize) -> c_int {
388389
let mut i = 0;
389390
while i < n {
390391
let a = *s1.wrapping_add(i);
391392
let b = *s2.wrapping_add(i);
392393
if a != b {
393-
return a as i32 - b as i32;
394+
return c_int::from(a) - c_int::from(b);
394395
}
395396
i += 1;
396397
}

library/compiler-builtins/compiler-builtins/src/mem/mod.rs

Lines changed: 3 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -3,13 +3,6 @@
33
// FIXME(e2024): this eventually needs to be removed.
44
#![allow(unsafe_op_in_unsafe_fn)]
55

6-
#[allow(warnings)]
7-
#[cfg(target_pointer_width = "16")]
8-
type c_int = i16;
9-
#[allow(warnings)]
10-
#[cfg(not(target_pointer_width = "16"))]
11-
type c_int = i32;
12-
136
// memcpy/memmove/memset have optimized implementations on some architectures
147
#[cfg_attr(
158
all(not(feature = "no-asm"), target_arch = "x86_64"),
@@ -38,18 +31,18 @@ intrinsics! {
3831
}
3932

4033
#[mem_builtin]
41-
pub unsafe extern "C" fn memset(s: *mut u8, c: crate::mem::c_int, n: usize) -> *mut u8 {
34+
pub unsafe extern "C" fn memset(s: *mut u8, c: core::ffi::c_int, n: usize) -> *mut u8 {
4235
impls::set_bytes(s, c as u8, n);
4336
s
4437
}
4538

4639
#[mem_builtin]
47-
pub unsafe extern "C" fn memcmp(s1: *const u8, s2: *const u8, n: usize) -> i32 {
40+
pub unsafe extern "C" fn memcmp(s1: *const u8, s2: *const u8, n: usize) -> core::ffi::c_int {
4841
impls::compare_bytes(s1, s2, n)
4942
}
5043

5144
#[mem_builtin]
52-
pub unsafe extern "C" fn bcmp(s1: *const u8, s2: *const u8, n: usize) -> i32 {
45+
pub unsafe extern "C" fn bcmp(s1: *const u8, s2: *const u8, n: usize) -> core::ffi::c_int {
5346
memcmp(s1, s2, n)
5447
}
5548

library/compiler-builtins/crates/josh-sync/Cargo.toml

Lines changed: 0 additions & 8 deletions
This file was deleted.

library/compiler-builtins/crates/josh-sync/src/main.rs

Lines changed: 0 additions & 45 deletions
This file was deleted.

0 commit comments

Comments
 (0)