Skip to content

Commit 01ae84e

Browse files
committed
Merge remote-tracking branch 'origin/main' into autoharness-support
2 parents 83dfb82 + f1aaa87 commit 01ae84e

File tree

45 files changed

+234
-93
lines changed

Some content is hidden

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

45 files changed

+234
-93
lines changed

.github/workflows/kani.yml

Lines changed: 27 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -158,3 +158,30 @@ jobs:
158158
.addHeading('Kani List Output', 2)
159159
.addRaw(kaniOutput, false)
160160
.write();
161+
162+
run-autoharness-analyzer:
163+
name: Kani Autoharness Analyzer
164+
runs-on: ubuntu-latest
165+
steps:
166+
# Step 1: Check out the repository
167+
- name: Checkout Repository
168+
uses: actions/checkout@v4
169+
with:
170+
submodules: true
171+
172+
# Step 2: Run autoharness analyzer on the std library
173+
- name: Run Autoharness Analyzer
174+
run: scripts/run-kani.sh --run autoharness-analyzer
175+
176+
# Step 3: Add output to job summary
177+
- name: Add Autoharness Analyzer output to job summary
178+
run: |
179+
echo "# Autoharness Failure Summary" >> "$GITHUB_STEP_SUMMARY"
180+
echo "## Crate core, all functions" >> "$GITHUB_STEP_SUMMARY"
181+
cat autoharness_analyzer/core_autoharness_data.md >> "$GITHUB_STEP_SUMMARY"
182+
echo "## Crate core, unsafe functions" >> "$GITHUB_STEP_SUMMARY"
183+
cat autoharness_analyzer/core_autoharness_data.md >> "$GITHUB_STEP_SUMMARY"
184+
echo "## Crate std, all functions" >> "$GITHUB_STEP_SUMMARY"
185+
cat autoharness_analyzer/std_autoharness_data.md >> "$GITHUB_STEP_SUMMARY"
186+
echo "## Crate std, unsafe functions" >> "$GITHUB_STEP_SUMMARY"
187+
cat autoharness_analyzer/std_unsafe_autoharness_data.md >> "$GITHUB_STEP_SUMMARY"

doc/src/SUMMARY.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -31,4 +31,4 @@
3131
- [15: Contracts and Tests for SIMD Intrinsics](./challenges/0015-intrinsics-simd.md)
3232
- [16: Verify the safety of Iterator functions](./challenges/0016-iter.md)
3333
- [17: Verify the safety of slice functions](./challenges/0017-slice.md)
34-
- [18: Verify the safety of slice iter functions](./challenges/0018-slice-iter-pt1.md)
34+
- [18: Verify the safety of slice iter functions](./challenges/0018-slice-iter.md)

library/Cargo.lock

Lines changed: 4 additions & 4 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
@@ -16,8 +16,8 @@ bench = false
1616

1717
[dependencies]
1818
core = { path = "../core", public = true }
19-
compiler_builtins = { version = "=0.1.155", features = ['rustc-dep-of-std'] }
2019
safety = { path = "../contracts/safety" }
20+
compiler_builtins = { version = "=0.1.156", features = ['rustc-dep-of-std'] }
2121

2222
[features]
2323
compiler-builtins-mem = ['compiler_builtins/mem']

library/alloc/src/ffi/c_str.rs

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -574,7 +574,7 @@ impl CString {
574574
#[stable(feature = "as_c_str", since = "1.20.0")]
575575
#[rustc_diagnostic_item = "cstring_as_c_str"]
576576
pub fn as_c_str(&self) -> &CStr {
577-
&*self
577+
unsafe { CStr::from_bytes_with_nul_unchecked(self.as_bytes_with_nul()) }
578578
}
579579

580580
/// Converts this `CString` into a boxed [`CStr`].
@@ -705,14 +705,14 @@ impl ops::Deref for CString {
705705

706706
#[inline]
707707
fn deref(&self) -> &CStr {
708-
unsafe { CStr::from_bytes_with_nul_unchecked(self.as_bytes_with_nul()) }
708+
self.as_c_str()
709709
}
710710
}
711711

712712
#[stable(feature = "rust1", since = "1.0.0")]
713713
impl fmt::Debug for CString {
714714
fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result {
715-
fmt::Debug::fmt(&**self, f)
715+
fmt::Debug::fmt(self.as_c_str(), f)
716716
}
717717
}
718718

library/alloctests/tests/c_str2.rs

Lines changed: 0 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -33,12 +33,6 @@ fn build_with_zero2() {
3333
assert!(CString::new(vec![0]).is_err());
3434
}
3535

36-
#[test]
37-
fn formatted() {
38-
let s = CString::new(&b"abc\x01\x02\n\xE2\x80\xA6\xFF"[..]).unwrap();
39-
assert_eq!(format!("{s:?}"), r#""abc\x01\x02\n\xe2\x80\xa6\xff""#);
40-
}
41-
4236
#[test]
4337
fn borrowed() {
4438
unsafe {

library/core/src/any.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -772,8 +772,8 @@ impl hash::Hash for TypeId {
772772
// (especially given the previous point about the lower 64 bits being
773773
// high quality on their own).
774774
// - It is correct to do so -- only hashing a subset of `self` is still
775-
// with an `Eq` implementation that considers the entire value, as
776-
// ours does.
775+
// compatible with an `Eq` implementation that considers the entire
776+
// value, as ours does.
777777
self.t.1.hash(state);
778778
}
779779
}

library/core/src/arch.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -32,7 +32,7 @@ pub macro asm("assembly template", $(operands,)* $(options($(option),*))?) {
3232
///
3333
/// [Rust By Example]: https://doc.rust-lang.org/nightly/rust-by-example/unsafe/asm.html
3434
/// [reference]: https://doc.rust-lang.org/nightly/reference/inline-assembly.html
35-
#[unstable(feature = "naked_functions", issue = "90957")]
35+
#[stable(feature = "naked_functions", since = "CURRENT_RUSTC_VERSION")]
3636
#[rustc_builtin_macro]
3737
pub macro naked_asm("assembly template", $(operands,)* $(options($(option),*))?) {
3838
/* compiler built-in */

library/core/src/bstr/mod.rs

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -36,8 +36,7 @@ use crate::ops::{Deref, DerefMut, DerefPure};
3636
/// presented as hex escape sequences.
3737
///
3838
/// The `Display` implementation behaves as if the `ByteStr` were first lossily converted to a
39-
/// `str`, with invalid UTF-8 presented as the Unicode replacement character: �
40-
///
39+
/// `str`, with invalid UTF-8 presented as the Unicode replacement character (�).
4140
#[unstable(feature = "bstr", issue = "134915")]
4241
#[repr(transparent)]
4342
#[doc(alias = "BStr")]

library/core/src/ffi/c_str.rs

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -157,7 +157,6 @@ impl Error for FromBytesWithNulError {
157157
/// within the slice.
158158
///
159159
/// This error is created by the [`CStr::from_bytes_until_nul`] method.
160-
///
161160
#[derive(Clone, PartialEq, Eq, Debug)]
162161
#[stable(feature = "cstr_from_bytes_until_nul", since = "1.69.0")]
163162
pub struct FromBytesUntilNulError(());

0 commit comments

Comments
 (0)