Skip to content

Commit ab6312f

Browse files
committed
Merge remote-tracking branch 'origin/main' into iter-range-rs-contracts
2 parents 6258c7d + 45ed9e9 commit ab6312f

File tree

949 files changed

+793534
-6981
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

949 files changed

+793534
-6981
lines changed

.github/workflows/kani-metrics.yml

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,13 @@ jobs:
1414
runs-on: ubuntu-latest
1515

1616
steps:
17+
- name: Remove unnecessary software to free up disk space
18+
run: |
19+
# inspired by https://github.com/easimon/maximize-build-space/blob/master/action.yml
20+
df -h
21+
sudo rm -rf /usr/share/dotnet /usr/local/lib/android /usr/local/.ghcup
22+
df -h
23+
1724
- name: Checkout Repository
1825
uses: actions/checkout@v4
1926
with:

.github/workflows/kani.yml

Lines changed: 31 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -37,6 +37,14 @@ jobs:
3737
WORKER_TOTAL: 4
3838

3939
steps:
40+
- name: Remove unnecessary software to free up disk space
41+
if: matrix.os == 'ubuntu-latest'
42+
run: |
43+
# inspired by https://github.com/easimon/maximize-build-space/blob/master/action.yml
44+
df -h
45+
sudo rm -rf /usr/share/dotnet /usr/local/lib/android /usr/local/.ghcup
46+
df -h
47+
4048
# Step 1: Check out the repository
4149
- name: Checkout Repository
4250
uses: actions/checkout@v4
@@ -67,6 +75,14 @@ jobs:
6775
fail-fast: false
6876

6977
steps:
78+
- name: Remove unnecessary software to free up disk space
79+
if: matrix.os == 'ubuntu-latest'
80+
run: |
81+
# inspired by https://github.com/easimon/maximize-build-space/blob/master/action.yml
82+
df -h
83+
sudo rm -rf /usr/share/dotnet /usr/local/lib/android /usr/local/.ghcup
84+
df -h
85+
7086
# Step 1: Check out the repository
7187
- name: Checkout Repository
7288
uses: actions/checkout@v4
@@ -159,6 +175,14 @@ jobs:
159175
fail-fast: true
160176

161177
steps:
178+
- name: Remove unnecessary software to free up disk space
179+
if: matrix.os == 'ubuntu-latest'
180+
run: |
181+
# inspired by https://github.com/easimon/maximize-build-space/blob/master/action.yml
182+
df -h
183+
sudo rm -rf /usr/share/dotnet /usr/local/lib/android /usr/local/.ghcup
184+
df -h
185+
162186
# Step 1: Check out the repository
163187
- name: Checkout Repository
164188
uses: actions/checkout@v4
@@ -253,6 +277,13 @@ jobs:
253277
name: Kani List
254278
runs-on: ubuntu-latest
255279
steps:
280+
- name: Remove unnecessary software to free up disk space
281+
run: |
282+
# inspired by https://github.com/easimon/maximize-build-space/blob/master/action.yml
283+
df -h
284+
sudo rm -rf /usr/share/dotnet /usr/local/lib/android /usr/local/.ghcup
285+
df -h
286+
256287
# Step 1: Check out the repository
257288
- name: Checkout Repository
258289
uses: actions/checkout@v4

.github/workflows/update-subtree.yml

Lines changed: 33 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,7 @@ defaults:
1111

1212
jobs:
1313
update-subtree-library:
14+
if: github.repository == 'model-checking/verify-rust-std'
1415
# Changing the host platform may alter the libgit2 version as used by
1516
# splitsh-lite, which will require changing the version of git2go.
1617
# See https://github.com/jeffWelling/git2go?tab=readme-ov-file#which-go-version-to-use
@@ -85,6 +86,7 @@ jobs:
8586
if: ${{ env.SUBTREE_PR_EXISTS == 'no' }}
8687
run: |
8788
cd splitsh-lite
89+
sudo apt-get update
8890
sudo apt-get install -y golang libgit2-dev
8991
# git2go upstream hasn't been updated to more recent versions of
9092
# libgit2, so using a fork that does stay up to date
@@ -110,6 +112,10 @@ jobs:
110112
fi
111113
112114
git checkout ${NEXT_COMMIT_HASH}
115+
# Collect submodule commits; note that submodules (intentionally!)
116+
# aren't initialized, hence lines will be prefixed with "-" (see git
117+
# submodule --help).
118+
git submodule status -- library/ | sed 's/^-//' > ../submodule-heads
113119
/usr/bin/time -v ../splitsh-lite/splitsh-lite --progress --prefix=library --target subtree/library
114120
git checkout -b subtree/library subtree/library
115121
@@ -165,6 +171,7 @@ jobs:
165171
fi
166172
fi
167173
git checkout main
174+
git submodule foreach 'git fetch'
168175
169176
# Tell git about the correct merge base to use, which is the subtree
170177
# head that we last merged from.
@@ -178,6 +185,8 @@ jobs:
178185
-c user.name=gitbot -c user.email=git@bot \
179186
merge -Xsubtree=library subtree/library; then
180187
echo "MERGE_CONFLICTS=yes" >> $GITHUB_ENV
188+
# Ignore submodule conflicts, those are dealt with below.
189+
for d in $(cat ../submodule-heads | cut -f2 -d" ") ; do git reset HEAD $d ; done
181190
git -c user.name=gitbot -c user.email=git@bot commit -a -m "Merge from $NEXT_COMMIT_HASH with conflicts"
182191
else
183192
echo "MERGE_CONFLICTS=no" >> $GITHUB_ENV
@@ -187,6 +196,14 @@ jobs:
187196
NEW_SUBTREE_HEAD=$(git rev-parse subtree/library)
188197
echo "NEW_SUBTREE_HEAD=${NEW_SUBTREE_HEAD}" >> $GITHUB_ENV
189198
199+
# Set submodules to upstream versions
200+
git submodule update --init
201+
git submodule foreach 'grep $sm_path $toplevel/../submodule-heads | cut -f1 -d" " | xargs git checkout'
202+
if ! git diff --quiet; then
203+
git -c user.name=gitbot -c user.email=git@bot \
204+
commit -m "Update submodules" library/
205+
fi
206+
190207
sed -i "s/^channel = \"nightly-.*\"/channel = \"nightly-${NEXT_TOOLCHAIN_DATE}\"/" rust-toolchain.toml
191208
git -c user.name=gitbot -c user.email=git@bot \
192209
commit -m "Update toolchain to ${NEXT_TOOLCHAIN_DATE}" rust-toolchain.toml
@@ -195,6 +212,22 @@ jobs:
195212
git -c user.name=gitbot -c user.email=git@bot \
196213
commit -m "Update Kani version to ${KANI_COMMIT_HASH}" tool_config/kani-version.toml
197214
215+
# Try to automatically patch the VeriFast proofs
216+
pushd verifast-proofs
217+
if bash ./patch-verifast-proofs.sh; then
218+
if ! git diff --quiet; then
219+
git -c user.name=gitbot -c user.email=git@bot \
220+
commit . -m "Update VeriFast proofs"
221+
else
222+
# The original files have not changed; no updates to the VeriFast proofs are necessary.
223+
true
224+
fi
225+
else
226+
# Patching the VeriFast proofs failed; requires manual intervention.
227+
true
228+
fi
229+
popd
230+
198231
- name: Create Pull Request without conflicts
199232
if: ${{ env.MERGE_CONFLICTS == 'no' && env.MERGE_PR_EXISTS == 'no' }}
200233
uses: peter-evans/create-pull-request@v7

doc/src/SUMMARY.md

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -36,4 +36,6 @@
3636
- [20: Verify the safety of char-related functions in str::pattern](./challenges/0020-str-pattern-pt1.md)
3737
- [21: Verify the safety of substring-related functions in str::pattern](./challenges/0021-str-pattern-pt2.md)
3838
- [22: Verify the safety of str iter functions](./challenges/0022-str-iter.md)
39+
- [23: Verify the safety of Vec functions part 1](./challenges/0023-vec-pt1.md)
40+
- [24: Verify the safety of Vec functions part 2](./challenges/0024-vec-pt2.md)
3941
- [25: Verify the safety of `VecDeque` functions](./challenges/0025-vecdeque.md)

doc/src/challenges/0023-vec-pt1.md

Lines changed: 78 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,78 @@
1+
# Challenge 23: Verify the safety of `Vec` functions part 1
2+
3+
- **Status:** Open
4+
- **Tracking Issue:** [#284](https://github.com/model-checking/verify-rust-std/issues/284)
5+
- **Start date:** *2025-03-07*
6+
- **End date:** *2025-10-17*
7+
- **Reward:** *15000 USD*
8+
9+
-------------------
10+
11+
12+
## Goal
13+
14+
Verify the safety of `std::Vec` functions (library/alloc/src/vec/mod.rs).
15+
16+
17+
### Success Criteria
18+
19+
Verify the safety of the following public functions in (library/alloc/src/vec/mod.rs):
20+
21+
| Function |
22+
|---------|
23+
|from_raw_parts|
24+
|from_nonnull|
25+
|from_nonnull_in|
26+
|into_raw_parts_with_alloc|
27+
|into_boxed_slice|
28+
|truncate|
29+
|set_len|
30+
|swap_remove|
31+
|insert|
32+
|remove|
33+
|retain_mut|
34+
|dedup_by|
35+
|push|
36+
|push_within_capacity|
37+
|pop|
38+
|append|
39+
|append_elements|
40+
|drain|
41+
|clear|
42+
|split_off|
43+
|leak|
44+
|spare_capacity_mut|
45+
|split_at_spare_mut|
46+
|split_at_spare_mut_with_len|
47+
|extend_from_within|
48+
|into_flattened|
49+
|extend_with|
50+
|spec_extend_from_within|
51+
|deref|
52+
|deref_mut|
53+
|into_iter|
54+
|extend_desugared|
55+
|extend_trusted|
56+
|extract_if|
57+
|drop|
58+
|try_from|
59+
60+
61+
62+
63+
The verification must be unbounded---it must hold for slices of arbitrary length.
64+
65+
The verification must hold for generic type `T` (no monomorphization).
66+
67+
### List of UBs
68+
69+
All proofs must automatically ensure the absence of the following undefined behaviors [ref](https://github.com/rust-lang/reference/blob/142b2ed77d33f37a9973772bd95e6144ed9dce43/src/behavior-considered-undefined.md):
70+
71+
* Accessing (loading from or storing to) a place that is dangling or based on a misaligned pointer.
72+
* Reading from uninitialized memory except for padding or unions.
73+
* Mutating immutable bytes.
74+
* Producing an invalid value
75+
76+
77+
Note: All solutions to verification challenges need to satisfy the criteria established in the [challenge book](../general-rules.md)
78+
in addition to the ones listed above.

doc/src/challenges/0024-vec-pt2.md

Lines changed: 67 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,67 @@
1+
# Challenge 24: Verify the safety of `Vec` functions part 2
2+
3+
- **Status:** Open
4+
- **Tracking Issue:** [#285](https://github.com/model-checking/verify-rust-std/issues/285)
5+
- **Start date:** *2025/03/07*
6+
- **End date:** *2025/10/17*
7+
- **Reward:** *15000 USD*
8+
9+
-------------------
10+
11+
12+
## Goal
13+
14+
Continue from part 1 (Challenge 23), for this challenge, you need to verify the safety of `std::Vec` iterator functions in other files in (library/alloc/src/vec/).
15+
16+
17+
### Success Criteria
18+
19+
Verify the safety of the following functions that in implemented for `IntoIter` in (library/alloc/src/vec/into_iter.rs):
20+
21+
| Function |
22+
|---------|
23+
|as_slice|
24+
|as_mut_slice|
25+
|forget_allocation_drop_remaining|
26+
|into_vecdeque|
27+
|next|
28+
|size_hint|
29+
|advance_by|
30+
|next_chunk|
31+
|fold|
32+
|try_fold|
33+
|__iterator_get_unchecked|
34+
|next_back|
35+
|advance_back_by|
36+
|drop|
37+
38+
and the following functions from other files:
39+
40+
| Function | in File|
41+
|---------|---------|
42+
|next| extract_if.rs|
43+
|spec_extend (for IntoIter) | spec_extend.rs |
44+
|spec_extend (for slice::Iter) | spec_extend.rs |
45+
|from_elem (for i8)| spec_from_elem.rs |
46+
|from_elem (for u8)| spec_from_elem.rs |
47+
|from_elem (for ())| spec_from_elem.rs |
48+
|from_iter| spec_from_iter.rs|
49+
|from_iter (default)| spec_from_iter_nested.rs|
50+
51+
52+
The verification must be unbounded---it must hold for slices of arbitrary length.
53+
54+
The verification must hold for generic type `T` (no monomorphization).
55+
56+
### List of UBs
57+
58+
All proofs must automatically ensure the absence of the following undefined behaviors [ref](https://github.com/rust-lang/reference/blob/142b2ed77d33f37a9973772bd95e6144ed9dce43/src/behavior-considered-undefined.md):
59+
60+
* Accessing (loading from or storing to) a place that is dangling or based on a misaligned pointer.
61+
* Reading from uninitialized memory except for padding or unions.
62+
* Mutating immutable bytes.
63+
* Producing an invalid value
64+
65+
66+
Note: All solutions to verification challenges need to satisfy the criteria established in the [challenge book](../general-rules.md)
67+
in addition to the ones listed above.

0 commit comments

Comments
 (0)