Skip to content

Commit e160d11

Browse files
committed
Merge remote-tracking branch 'origin/main' into from_mut_unchecked
2 parents 196da12 + 45ed9e9 commit e160d11

File tree

1,133 files changed

+804920
-13623
lines changed

Some content is hidden

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

1,133 files changed

+804920
-13623
lines changed

.github/workflows/kani-metrics.yml

Lines changed: 10 additions & 1 deletion
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:
@@ -26,7 +33,9 @@ jobs:
2633
python-version: '3.x'
2734

2835
- name: Compute Kani Metrics
29-
run: ./scripts/run-kani.sh --run metrics --with-autoharness --path ${{github.workspace}}
36+
run: |
37+
./scripts/run-kani.sh --run metrics --with-autoharness --path ${{github.workspace}}
38+
rm kani-list.json
3039
3140
- name: Create Pull Request
3241
uses: peter-evans/create-pull-request@v7

.github/workflows/kani.yml

Lines changed: 161 additions & 7 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
@@ -53,7 +61,7 @@ jobs:
5361
- name: Run Kani Verification
5462
run: head/scripts/run-kani.sh --path ${{github.workspace}}/head
5563

56-
kani-autoharness:
64+
kani_autoharness:
5765
name: Verify std library using autoharness
5866
runs-on: ${{ matrix.os }}
5967
strategy:
@@ -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
@@ -78,9 +94,16 @@ jobs:
7894
# possible functions as that may take a lot longer than expected. Instead,
7995
# explicitly list all functions (or prefixes thereof) the proofs of which
8096
# are known to pass.
97+
# Notes:
98+
# - We use >::disjoint_bitor (and >::unchecked_disjoint_bitor) as pattern
99+
# as whitespace is not supported, cf.
100+
# https://github.com/model-checking/kani/issues/4046
81101
- name: Run Kani Verification
82102
run: |
83103
scripts/run-kani.sh --run autoharness --kani-args \
104+
--include-pattern ">::disjoint_bitor" \
105+
--include-pattern ">::unchecked_disjoint_bitor" \
106+
--include-pattern alloc::__default_lib_allocator:: \
84107
--include-pattern alloc::layout::Layout::from_size_align \
85108
--include-pattern ascii::ascii_char::AsciiChar::from_u8 \
86109
--include-pattern char::convert::from_u32_unchecked \
@@ -122,14 +145,143 @@ jobs:
122145
--exclude-pattern time::Duration::from_secs_f \
123146
--include-pattern unicode::unicode_data::conversions::to_ \
124147
--exclude-pattern ::precondition_check \
125-
--harness-timeout 5m \
148+
--harness-timeout 10m \
126149
--default-unwind 1000 \
127-
--jobs=3 --output-format=terse
150+
--jobs=3 --output-format=terse | tee autoharness-verification.log
151+
gzip autoharness-verification.log
152+
153+
- name: Upload Autoharness Verification Log
154+
uses: actions/upload-artifact@v4
155+
with:
156+
name: ${{ matrix.os }}-autoharness-verification.log.gz
157+
path: autoharness-verification.log.gz
158+
if-no-files-found: error
159+
# Aggressively short retention: we don't really need these
160+
retention-days: 3
161+
162+
run_kani_metrics:
163+
name: Kani Metrics
164+
runs-on: ${{ matrix.os }}
165+
strategy:
166+
matrix:
167+
os: [ubuntu-latest, macos-latest]
168+
include:
169+
- os: ubuntu-latest
170+
base: ubuntu
171+
- os: macos-latest
172+
base: macos
173+
fail-fast: true
174+
175+
steps:
176+
- name: Remove unnecessary software to free up disk space
177+
if: matrix.os == 'ubuntu-latest'
178+
run: |
179+
# inspired by https://github.com/easimon/maximize-build-space/blob/master/action.yml
180+
df -h
181+
sudo rm -rf /usr/share/dotnet /usr/local/lib/android /usr/local/.ghcup
182+
df -h
183+
184+
# Step 1: Check out the repository
185+
- name: Checkout Repository
186+
uses: actions/checkout@v4
187+
with:
188+
submodules: true
189+
190+
# The Kani metrics collection uses a Python script (kani_std_analysis.py), so make sure Python is installed
191+
- name: Set up Python
192+
uses: actions/setup-python@v4
193+
with:
194+
python-version: '3.x'
195+
196+
# Step 2: Run list on the std library
197+
- name: Run Kani Metrics
198+
run: |
199+
scripts/run-kani.sh --run metrics --with-autoharness
200+
pushd /tmp/std_lib_analysis
201+
tar czf results.tar.gz results
202+
popd
203+
204+
- name: Upload kani-list.json
205+
uses: actions/upload-artifact@v4
206+
with:
207+
name: ${{ matrix.os }}-kani-list.json
208+
path: kani-list.json
209+
if-no-files-found: error
210+
# Aggressively short retention: we don't really need these
211+
retention-days: 3
212+
213+
- name: Upload scanner results
214+
uses: actions/upload-artifact@v4
215+
with:
216+
name: ${{ matrix.os }}-results.tar.gz
217+
path: /tmp/std_lib_analysis/results.tar.gz
218+
if-no-files-found: error
219+
# Aggressively short retention: we don't really need these
220+
retention-days: 3
221+
222+
run-log-analysis:
223+
name: Build JSON from logs
224+
needs: [run_kani_metrics, kani_autoharness]
225+
runs-on: ${{ matrix.os }}
226+
strategy:
227+
matrix:
228+
os: [ubuntu-latest, macos-latest]
229+
include:
230+
- os: ubuntu-latest
231+
base: ubuntu
232+
- os: macos-latest
233+
base: macos
234+
fail-fast: false
235+
236+
steps:
237+
- name: Checkout Repository
238+
uses: actions/checkout@v4
239+
with:
240+
submodules: false
241+
242+
- name: Download log
243+
uses: actions/download-artifact@v4
244+
with:
245+
name: ${{ matrix.os }}-autoharness-verification.log.gz
246+
247+
- name: Download kani-list.json
248+
uses: actions/download-artifact@v4
249+
with:
250+
name: ${{ matrix.os }}-kani-list.json
251+
252+
- name: Download scanner results
253+
uses: actions/download-artifact@v4
254+
with:
255+
name: ${{ matrix.os }}-results.tar.gz
256+
257+
- name: Run log parser
258+
run: |
259+
gunzip autoharness-verification.log.gz
260+
tar xzf results.tar.gz
261+
python3 scripts/kani-std-analysis/log_parser.py \
262+
--kani-list-file kani-list.json \
263+
--analysis-results-dir results/ \
264+
autoharness-verification.log \
265+
-o results.json
266+
267+
- name: Upload JSON
268+
uses: actions/upload-artifact@v4
269+
with:
270+
name: ${{ matrix.os }}-results.json
271+
path: results.json
272+
if-no-files-found: error
128273

129274
run-kani-list:
130275
name: Kani List
131276
runs-on: ubuntu-latest
132277
steps:
278+
- name: Remove unnecessary software to free up disk space
279+
run: |
280+
# inspired by https://github.com/easimon/maximize-build-space/blob/master/action.yml
281+
df -h
282+
sudo rm -rf /usr/share/dotnet /usr/local/lib/android /usr/local/.ghcup
283+
df -h
284+
133285
# Step 1: Check out the repository
134286
- name: Checkout Repository
135287
uses: actions/checkout@v4
@@ -176,12 +328,14 @@ jobs:
176328
# Step 3: Add output to job summary
177329
- name: Add Autoharness Analyzer output to job summary
178330
run: |
331+
pushd scripts/autoharness_analyzer
179332
echo "# Autoharness Failure Summary" >> "$GITHUB_STEP_SUMMARY"
180333
echo "## Crate core, all functions" >> "$GITHUB_STEP_SUMMARY"
181-
cat autoharness_analyzer/core_autoharness_data.md >> "$GITHUB_STEP_SUMMARY"
334+
cat core_autoharness_data.md >> "$GITHUB_STEP_SUMMARY"
182335
echo "## Crate core, unsafe functions" >> "$GITHUB_STEP_SUMMARY"
183-
cat autoharness_analyzer/core_autoharness_data.md >> "$GITHUB_STEP_SUMMARY"
336+
cat core_autoharness_data.md >> "$GITHUB_STEP_SUMMARY"
184337
echo "## Crate std, all functions" >> "$GITHUB_STEP_SUMMARY"
185-
cat autoharness_analyzer/std_autoharness_data.md >> "$GITHUB_STEP_SUMMARY"
338+
cat std_autoharness_data.md >> "$GITHUB_STEP_SUMMARY"
186339
echo "## Crate std, unsafe functions" >> "$GITHUB_STEP_SUMMARY"
187-
cat autoharness_analyzer/std_unsafe_autoharness_data.md >> "$GITHUB_STEP_SUMMARY"
340+
cat std_unsafe_autoharness_data.md >> "$GITHUB_STEP_SUMMARY"
341+
popd

.github/workflows/pr_approval.yml

Lines changed: 23 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -73,6 +73,21 @@ jobs:
7373
return;
7474
}
7575
76+
// Get the list of changed files
77+
const { data: changedFiles } = await github.rest.pulls.listFiles({
78+
owner,
79+
repo,
80+
pull_number,
81+
});
82+
83+
// Check if any files in doc/, library/ or verifast-proofs/ are modified
84+
const affectsDocs = changedFiles.some(file => file.filename.startsWith('doc/'));
85+
const affectsLibrary = changedFiles.some(file => file.filename.startsWith('library/'));
86+
const affectsVerifast = changedFiles.some(file => file.filename.startsWith('verifast-proofs/'));
87+
// Require two approvals iff one of the above folders are modified; otherwise, one is sufficient.
88+
const requiresTwoApprovals = affectsDocs || affectsLibrary || affectsVerifast;
89+
const requiredApprovals = requiresTwoApprovals ? 2 : 1;
90+
7691
// Get all reviews with pagination
7792
async function getAllReviews() {
7893
let allReviews = [];
@@ -113,23 +128,27 @@ jobs:
113128
.map(review => review.user.login)
114129
);
115130
116-
const requiredApprovals = 2;
117131
const committeeApprovers = Array.from(approvers)
118132
.filter(approver => requiredApprovers.includes(approver));
119133
const currentCountfromCommittee = committeeApprovers.length;
120134
121-
// Core logic that checks if the approvers are in the committee
122-
const conclusion = (currentCountfromCommittee >= 2) ? 'success' : 'failure';
135+
// Check if we have enough approvals
136+
const conclusion = (currentCountfromCommittee >= requiredApprovals) ? 'success' : 'failure';
123137
124138
console.log('PR Approval Status');
139+
console.log('Modified folders:');
140+
console.log(`- doc/: ${affectsDocs ? 'yes' : 'no'}`);
141+
console.log(`- library/: ${affectsLibrary ? 'yes' : 'no'}`);
142+
console.log(`- verifast-proofs/: ${affectsVerifast ? 'yes' : 'no'}`);
143+
console.log(`Required approvals from committee: ${requiredApprovals}`);
125144
console.log(`PR has ${approvers.size} total approvals and ${currentCountfromCommittee} required approvals from the committee.`);
126145
127146
console.log(`Committee Members: [${requiredApprovers.join(', ')}]`);
128147
console.log(`Committee Approvers: ${committeeApprovers.length === 0 ? 'NONE' : `[${committeeApprovers.join(', ')}]`}`);
129148
console.log(`All Approvers: ${approvers.size === 0 ? 'NONE' : `[${Array.from(approvers).join(', ')}]`}`);
130149
131150
if (conclusion === 'failure') {
132-
core.setFailed(`PR needs 2 approvals from committee members, but it has ${currentCountfromCommittee}`);
151+
core.setFailed(`PR needs ${requiredApprovals} approval${requiredApprovals > 1 ? 's' : ''} from committee members, but it has ${currentCountfromCommittee}`);
133152
} else {
134153
core.info('PR approval check passed successfully.');
135154
}

.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

.gitignore

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -22,6 +22,7 @@ Session.vim
2222
/kani_build/
2323
/target
2424
library/target
25+
scripts/autoharness_analyzer/target/
2526
*.rlib
2627
*.rmeta
2728
*.mir

doc/mdbook-metrics/Cargo.toml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,4 +5,5 @@ edition = "2021"
55

66
[dependencies]
77
mdbook = { version = "^0.4" }
8+
mdbook-linkcheck = "0.7.7"
89
serde_json = "1.0.132"

0 commit comments

Comments
 (0)