Skip to content

Merge subtree update for toolchain nightly-2025-03-02 #9

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed
wants to merge 8 commits into from
Closed
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
The table of contents is too big for display.
Diff view
Diff view
  •  
  •  
  •  
42 changes: 28 additions & 14 deletions .github/workflows/update-subtree.yml
Original file line number Diff line number Diff line change
@@ -11,7 +11,10 @@ defaults:

jobs:
update-subtree-library:
runs-on: ubuntu-latest
# Changing the host platform may alter the libgit2 version as used by
# splitsh-lite, which will require changing the version of git2go.
# See https://github.com/jeffWelling/git2go?tab=readme-ov-file#which-go-version-to-use
runs-on: ubuntu-24.04

steps:
- name: Checkout Repository
@@ -34,12 +37,6 @@ jobs:
fetch-depth: 0
path: rust-tmp

- name: Checkout git-filter-repo
uses: actions/checkout@v4
with:
repository: newren/git-filter-repo
path: git-filter-repo

- name: Fetch toolchain versions
run: |
CURRENT_TOOLCHAIN_DATE=$(grep -oP 'channel = "nightly-\K\d{4}-\d{2}-\d{2}' verify-rust-std/rust-toolchain.toml)
@@ -77,6 +74,24 @@ jobs:
env:
GH_TOKEN: ${{ github.token }}

- name: Checkout splitsh-lite
if: ${{ env.SUBTREE_PR_EXISTS == 'no' }}
uses: actions/checkout@v4
with:
repository: splitsh/lite
path: splitsh-lite

- name: Build splitsh-lite
if: ${{ env.SUBTREE_PR_EXISTS == 'no' }}
run: |
cd splitsh-lite
sudo apt-get install -y libgit2-dev
sed -i 's#github.com/libgit2/git2go#github.com/jeffwelling/git2go#' go.mod splitter/*
sed -i -e 's/v34/v37/g' go.mod splitter/*.go
sed -i 's/v37.0.0/v37.0.4/' go.mod
go mod tidy
go build -o splitsh-lite github.com/splitsh/lite

- name: Update subtree/library locally
if: ${{ env.SUBTREE_PR_EXISTS == 'no' }}
run: |
@@ -89,16 +104,13 @@ jobs:
fi

git checkout ${NEXT_COMMIT_HASH}
../git-filter-repo/git-filter-repo --subdirectory-filter library --force
git checkout -b subtree/library
/usr/bin/time -v ../splitsh-lite/splitsh-lite --progress --prefix=library --target subtree/library
git checkout -b subtree/library subtree/library

cd ../verify-rust-std
git remote add rust-filtered ../rust-tmp/
git fetch rust-filtered
git checkout -b subtree/library rust-filtered/subtree/library
# The filter-subtree operation adds an extraneous `library/` folder containing the submodules
# (c.f. https://github.com/model-checking/verify-rust-std/issues/249), so remove that before committing.
rm -rf library
SUBTREE_HEAD_MSG=$(git log --format=%s -n 1 origin/subtree/library)
UPSTREAM_FROM=$(git log --grep="${SUBTREE_HEAD_MSG}" -n 1 --format=%H rust-filtered/subtree/library)
UPSTREAM_HEAD=$(git log --format=%H -n 1 rust-filtered/subtree/library)
@@ -107,7 +119,6 @@ jobs:
echo "MERGE_CONFLICTS=noop" >> $GITHUB_ENV
else
git branch --set-upstream-to=origin/subtree/library
git -c user.name=gitbot -c user.email=git@bot rebase
echo "MERGE_CONFLICTS=maybe" >> $GITHUB_ENV
fi

@@ -130,12 +141,15 @@ jobs:
if: ${{ env.MERGE_CONFLICTS != 'noop' && env.MERGE_PR_EXISTS == 'no' }}
run: |
cd verify-rust-std
if ! git rev-parse --verify subtree/library; then
git checkout -t -b subtree/library origin/update-subtree/library
fi
git checkout main

# This command may fail, which will require human intervention.
if ! git \
-c user.name=gitbot -c user.email=git@bot \
subtree merge --prefix=library update-subtree/library --squash; then
subtree merge --prefix=library subtree/library --squash; then
echo "MERGE_CONFLICTS=yes" >> $GITHUB_ENV
git -c user.name=gitbot -c user.email=git@bot commit -a -m "Merge from $NEXT_COMMIT_HASH with conflicts"
else
80 changes: 74 additions & 6 deletions library/Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

11 changes: 9 additions & 2 deletions library/alloc/Cargo.toml
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
cargo-features = ["public-dependency"]

[package]
name = "alloc"
version = "0.0.0"
@@ -9,13 +11,18 @@ autobenches = false
edition = "2021"

[dependencies]
<<<<<<< HEAD
core = { path = "../core" }
compiler_builtins = { version = "=0.1.145", features = ['rustc-dep-of-std'] }
safety = { path = "../contracts/safety" }
=======
core = { path = "../core", public = true }
compiler_builtins = { version = "=0.1.148", features = ['rustc-dep-of-std'] }
>>>>>>> 30728aeafb88a31d3ab35f64dc75a07082413491

[dev-dependencies]
rand = { version = "0.8.5", default-features = false, features = ["alloc"] }
rand_xorshift = "0.3.0"
rand = { version = "0.9.0", default-features = false, features = ["alloc"] }
rand_xorshift = "0.4.0"

[[test]]
name = "alloctests"
24 changes: 12 additions & 12 deletions library/alloc/benches/btree/map.rs
Original file line number Diff line number Diff line change
@@ -9,19 +9,19 @@ macro_rules! map_insert_rand_bench {
($name: ident, $n: expr, $map: ident) => {
#[bench]
pub fn $name(b: &mut Bencher) {
let n: usize = $n;
let n: u32 = $n;
let mut map = $map::new();
// setup
let mut rng = crate::bench_rng();

for _ in 0..n {
let i = rng.gen::<usize>() % n;
let i = rng.random::<u32>() % n;
map.insert(i, i);
}

// measure
b.iter(|| {
let k = rng.gen::<usize>() % n;
let k = rng.random::<u32>() % n;
map.insert(k, k);
map.remove(&k);
});
@@ -57,13 +57,13 @@ macro_rules! map_from_iter_rand_bench {
($name: ident, $n: expr, $map: ident) => {
#[bench]
pub fn $name(b: &mut Bencher) {
let n: usize = $n;
let n: u32 = $n;
// setup
let mut rng = crate::bench_rng();
let mut vec = Vec::with_capacity(n);
let mut vec = Vec::with_capacity(n as usize);

for _ in 0..n {
let i = rng.gen::<usize>() % n;
let i = rng.random::<u32>() % n;
vec.push((i, i));
}

@@ -102,11 +102,11 @@ macro_rules! map_find_rand_bench {
#[bench]
pub fn $name(b: &mut Bencher) {
let mut map = $map::new();
let n: usize = $n;
let n: u32 = $n;

// setup
let mut rng = crate::bench_rng();
let mut keys: Vec<_> = (0..n).map(|_| rng.gen::<usize>() % n).collect();
let mut keys: Vec<_> = (0..n).map(|_| rng.random::<u32>() % n).collect();

for &k in &keys {
map.insert(k, k);
@@ -115,9 +115,9 @@ macro_rules! map_find_rand_bench {
keys.shuffle(&mut rng);

// measure
let mut i = 0;
let mut i = 0u32;
b.iter(|| {
let t = map.get(&keys[i]);
let t = map.get(&keys[i as usize]);
i = (i + 1) % n;
black_box(t);
})
@@ -171,7 +171,7 @@ fn bench_iteration(b: &mut Bencher, size: i32) {
let mut rng = crate::bench_rng();

for _ in 0..size {
map.insert(rng.gen(), rng.gen());
map.insert(rng.random(), rng.random());
}

b.iter(|| {
@@ -201,7 +201,7 @@ fn bench_iteration_mut(b: &mut Bencher, size: i32) {
let mut rng = crate::bench_rng();

for _ in 0..size {
map.insert(rng.gen(), rng.gen());
map.insert(rng.random(), rng.random());
}

b.iter(|| {
8 changes: 4 additions & 4 deletions library/alloc/benches/btree/set.rs
Original file line number Diff line number Diff line change
@@ -3,13 +3,13 @@ use std::collections::BTreeSet;
use rand::Rng;
use test::Bencher;

fn random(n: usize) -> BTreeSet<usize> {
fn random(n: u32) -> BTreeSet<u32> {
let mut rng = crate::bench_rng();
let mut set = BTreeSet::new();
while set.len() < n {
set.insert(rng.gen());
while set.len() < n as usize {
set.insert(rng.random());
}
assert_eq!(set.len(), n);
assert_eq!(set.len(), n as usize);
set
}

Loading