Skip to content

Commit 3815a34

Browse files
authored
Merge branch 'main' into new_challenge_convert_num
2 parents 1199e83 + b6552b8 commit 3815a34

File tree

180 files changed

+12183
-6613
lines changed

Some content is hidden

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

180 files changed

+12183
-6613
lines changed

.github/pull_requests.toml

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,5 +16,7 @@ members = [
1616
"robdockins",
1717
"HuStmpHrrr",
1818
"Eh2406",
19-
"jswrenn"
19+
"jswrenn",
20+
"havelund",
21+
"jorajeev"
2022
]

.github/workflows/book.yml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,7 @@
33
name: Build Book
44
on:
55
workflow_dispatch:
6+
merge_group:
67
pull_request:
78
branches: [ main ]
89
push:

.github/workflows/kani.yml

Lines changed: 12 additions & 26 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,7 @@ name: Kani
22

33
on:
44
workflow_dispatch:
5+
merge_group:
56
pull_request:
67
branches: [ main ]
78
push:
@@ -37,18 +38,10 @@ jobs:
3738
# Step 2: Run Kani on the std library (default configuration)
3839
- name: Run Kani Verification
3940
run: head/scripts/run-kani.sh --path ${{github.workspace}}/head
40-
41-
test-kani-script:
42-
name: Test Kani script
43-
runs-on: ${{ matrix.os }}
44-
strategy:
45-
matrix:
46-
os: [ubuntu-latest, macos-latest]
47-
include:
48-
- os: ubuntu-latest
49-
base: ubuntu
50-
- os: macos-latest
51-
base: macos
41+
42+
run-kani-list:
43+
name: Kani List
44+
runs-on: ubuntu-latest
5245
steps:
5346
# Step 1: Check out the repository
5447
- name: Checkout Repository
@@ -57,25 +50,18 @@ jobs:
5750
path: head
5851
submodules: true
5952

60-
# Step 2: Test Kani verification script with specific arguments
61-
- name: Test Kani script (Custom Args)
62-
run: head/scripts/run-kani.sh -p ${{github.workspace}}/head --kani-args --harness ptr --output-format=terse
63-
64-
# Step 3: Test Kani verification script in the repository directory
65-
- name: Test Kani script (In Repo Directory)
66-
working-directory: ${{github.workspace}}/head
67-
run: scripts/run-kani.sh --kani-args --harness ptr::verify::check_read_u128 --harness ptr --output-format=terse
68-
69-
# Step 4: Run list on the std library and add output to job summary
53+
# Step 2: Run list on the std library
7054
- name: Run Kani List
7155
run: head/scripts/run-kani.sh --run list --path ${{github.workspace}}/head
72-
56+
57+
# Step 3: Add output to job summary
7358
- name: Add Kani List output to job summary
7459
uses: actions/github-script@v6
7560
with:
7661
script: |
7762
const fs = require('fs');
78-
const kaniOutput = fs.readFileSync('${{github.workspace}}/head/kani_list.txt', 'utf8');
63+
const kaniOutput = fs.readFileSync('${{github.workspace}}/head/kani-list.md', 'utf8');
7964
await core.summary
80-
.addRaw(kaniOutput)
81-
.write();
65+
.addHeading('Kani List Output', 2)
66+
.addRaw(kaniOutput, false)
67+
.write();

.github/workflows/pr_approval.yml

Lines changed: 14 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,25 +1,33 @@
1+
# This workflow checks that the PR has been approved by 2+ members of the committee listed in `pull_requests.toml`.
2+
#
3+
# Run this action when a pull request review is submitted / dismissed.
4+
# Note that an approval can be dismissed, and this can affect the job status.
5+
# We currently trust that contributors won't make significant changes to their PRs after approval, so we accept
6+
# changes after approval.
7+
#
8+
# We still need to run this in the case of a merge group, since it is a required step. In that case, the workflow
9+
# is a NOP.
110
name: Check PR Approvals
2-
3-
# For now, the workflow gets triggered only when a review is submitted
4-
# This technically means, a PR with zero approvals can be merged by the rules of this workflow alone
5-
# To protect against that scenario, we can turn on number of approvals required to 2 in the github settings
6-
# of the repository
711
on:
12+
merge_group:
813
pull_request_review:
9-
types: [submitted]
14+
types: [submitted, dismissed]
1015

1116
jobs:
1217
check-approvals:
1318
runs-on: ubuntu-latest
1419
steps:
1520
- name: Checkout repository
1621
uses: actions/checkout@v2
22+
if: ${{ github.event_name != 'merge_group' }}
1723

1824
- name: Install TOML parser
1925
run: npm install @iarna/toml
26+
if: ${{ github.event_name != 'merge_group' }}
2027

2128
- name: Check PR Relevance and Approvals
2229
uses: actions/github-script@v6
30+
if: ${{ github.event_name != 'merge_group' }}
2331
with:
2432
script: |
2533
const fs = require('fs');

.github/workflows/rustc.yml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,7 @@
44
name: Rust Tests
55
on:
66
workflow_dispatch:
7+
merge_group:
78
pull_request:
89
branches: [ main ]
910
push:

doc/src/challenges/0002-intrinsics-memory.md

Lines changed: 23 additions & 23 deletions
Original file line numberDiff line numberDiff line change
@@ -24,29 +24,29 @@ Annotate Rust core::intrinsics functions that manipulate raw pointers with their
2424

2525
Intrinsic functions to be annotated with safety contracts
2626

27-
| Function | Location |
28-
|---------|---------|
29-
|typed_swap | core::intrisics |
30-
|vtable_size| core::intrisics |
31-
|vtable_align| core::intrisics |
32-
|copy_nonoverlapping| core::intrisics |
33-
|copy| core::intrisics |
34-
|write_bytes| core::intrisics |
35-
|size_of_val| core::intrisics |
36-
|arith_offset| core::intrisics |
37-
|volatile_copy_nonoverlapping_memory| core::intrisics |
38-
|volatile_copy_memory| core::intrisics |
39-
|volatile_set_memory| core::intrisics |
40-
|volatile_load| core::intrisics |
41-
|volatile_store| core::intrisics |
42-
|unaligned_volatile_load| core::intrisics |
43-
|unaligned_volatile_store| core::intrisics |
44-
|compare_bytes| core::intrisics |
45-
|min_align_of_val| core::intrisics |
46-
|ptr_offset_from| core::intrisics |
47-
|ptr_offset_from_unsigned| core::intrisics |
48-
|read_via_copy| core::intrisics |
49-
|write_via_move| core::intrisics |
27+
| Function | Location |
28+
|-------------------------------------|-----------------|
29+
| typed_swap | core::intrisics |
30+
| vtable_size | core::intrisics |
31+
| vtable_align | core::intrisics |
32+
| copy_nonoverlapping | core::intrisics |
33+
| copy | core::intrisics |
34+
| write_bytes | core::intrisics |
35+
| size_of_val | core::intrisics |
36+
| arith_offset | core::intrisics |
37+
| volatile_copy_nonoverlapping_memory | core::intrisics |
38+
| volatile_copy_memory | core::intrisics |
39+
| volatile_set_memory | core::intrisics |
40+
| volatile_load | core::intrisics |
41+
| volatile_store | core::intrisics |
42+
| unaligned_volatile_load | core::intrisics |
43+
| unaligned_volatile_store | core::intrisics |
44+
| compare_bytes | core::intrisics |
45+
| min_align_of_val | core::intrisics |
46+
| ptr_offset_from | core::intrisics |
47+
| ptr_offset_from_unsigned | core::intrisics |
48+
| read_via_copy | core::intrisics |
49+
| write_via_move | core::intrisics |
5050

5151

5252
All the following usages of intrinsics were proven safe:

doc/src/challenges/0003-pointer-arithmentic.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -88,7 +88,7 @@ At least 3 of the following usages were proven safe:
8888

8989
| Function | Location |
9090
|-------------------|---------------|
91-
| \[u8\]::is_asc_ii | core::slice |
91+
| \[u8\]::is_ascii | core::slice |
9292
| String::remove | alloc::string |
9393
| Vec::swap_remove | alloc::vec |
9494
| Option::as_slice | core::option |

doc/src/challenges/0011-floats-ints.md

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,12 @@
11
# Challenge 11: Safety of Methods for Numeric Primitive Types
22

33

4-
- **Status:** Open
4+
- **Status:** Resolved
55
- **Tracking Issue:** [#59](https://github.com/model-checking/verify-rust-std/issues/59)
66
- **Start date:** *2024/08/20*
7-
- **End date:** *2025/04/10*
7+
- **End date:** *2024/12/04*
88
- **Reward:** *N/A*
9+
- **Contributors**: [Rajath M Kotyal](https://github.com/rajathkotyal), [Yen-Yun Wu](https://github.com/Yenyun035), [Lanfei Ma](https://github.com/lanfeima), [Junfeng Jin](https://github.com/MWDZ)
910

1011
-------------------
1112

doc/src/tools.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@ The verification tool ecosystem for Rust is rapidly growing, and we welcome the
44
In this chapter, you can find a list of tools that have already been approved for new solutions,
55
what is their CI current status, as well as more details on how to use them.
66

7-
If the tool you would like to add a new tool to the list of tool applications,
7+
If you would like to add a new tool to the list of tool applications,
88
please see the [Tool Application](general-rules.md#tool-applications) section.
99

1010
## Approved tools:

library/Cargo.lock

Lines changed: 14 additions & 15 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

library/alloc/Cargo.toml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@ edition = "2021"
1010

1111
[dependencies]
1212
core = { path = "../core" }
13-
compiler_builtins = { version = "0.1.123", features = ['rustc-dep-of-std'] }
13+
compiler_builtins = { version = "=0.1.138", features = ['rustc-dep-of-std'] }
1414
safety = { path = "../contracts/safety" }
1515

1616
[dev-dependencies]

library/alloc/src/alloc.rs

Lines changed: 8 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -61,7 +61,7 @@ pub use std::alloc::Global;
6161
/// of the allocator registered with the `#[global_allocator]` attribute
6262
/// if there is one, or the `std` crate’s default.
6363
///
64-
/// This function is expected to be deprecated in favor of the `alloc` method
64+
/// This function is expected to be deprecated in favor of the `allocate` method
6565
/// of the [`Global`] type when it and the [`Allocator`] trait become stable.
6666
///
6767
/// # Safety
@@ -106,7 +106,7 @@ pub unsafe fn alloc(layout: Layout) -> *mut u8 {
106106
/// of the allocator registered with the `#[global_allocator]` attribute
107107
/// if there is one, or the `std` crate’s default.
108108
///
109-
/// This function is expected to be deprecated in favor of the `dealloc` method
109+
/// This function is expected to be deprecated in favor of the `deallocate` method
110110
/// of the [`Global`] type when it and the [`Allocator`] trait become stable.
111111
///
112112
/// # Safety
@@ -125,7 +125,7 @@ pub unsafe fn dealloc(ptr: *mut u8, layout: Layout) {
125125
/// of the allocator registered with the `#[global_allocator]` attribute
126126
/// if there is one, or the `std` crate’s default.
127127
///
128-
/// This function is expected to be deprecated in favor of the `realloc` method
128+
/// This function is expected to be deprecated in favor of the `grow` and `shrink` methods
129129
/// of the [`Global`] type when it and the [`Allocator`] trait become stable.
130130
///
131131
/// # Safety
@@ -145,7 +145,7 @@ pub unsafe fn realloc(ptr: *mut u8, layout: Layout, new_size: usize) -> *mut u8
145145
/// of the allocator registered with the `#[global_allocator]` attribute
146146
/// if there is one, or the `std` crate’s default.
147147
///
148-
/// This function is expected to be deprecated in favor of the `alloc_zeroed` method
148+
/// This function is expected to be deprecated in favor of the `allocate_zeroed` method
149149
/// of the [`Global`] type when it and the [`Allocator`] trait become stable.
150150
///
151151
/// # Safety
@@ -155,11 +155,14 @@ pub unsafe fn realloc(ptr: *mut u8, layout: Layout, new_size: usize) -> *mut u8
155155
/// # Examples
156156
///
157157
/// ```
158-
/// use std::alloc::{alloc_zeroed, dealloc, Layout};
158+
/// use std::alloc::{alloc_zeroed, dealloc, handle_alloc_error, Layout};
159159
///
160160
/// unsafe {
161161
/// let layout = Layout::new::<u16>();
162162
/// let ptr = alloc_zeroed(layout);
163+
/// if ptr.is_null() {
164+
/// handle_alloc_error(layout);
165+
/// }
163166
///
164167
/// assert_eq!(*(ptr as *mut u16), 0);
165168
///

0 commit comments

Comments
 (0)