-
Notifications
You must be signed in to change notification settings - Fork 55
align_to and align_to_mut contract and harnesses #405
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
base: main
Are you sure you want to change the base?
Conversation
Thank you! We should have a fix for the Kani issue with model-checking/kani#4151 really soon, so I'd love to hold off on this one for about a week so that we can get the Kani fix merged and have this repository use the updated Kani version. |
@AlexLB99 We now have the Kani fix merged and the version of Kani that this repository uses includes this fix. Could you please adjust your implementation so as not to use a workaround anymore? |
Thanks for letting me know -- I've added a new commit that removes the workaround (so now |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Please review what changes are actually intended.
library/core/src/slice/mod.rs
Outdated
@@ -1316,7 +1320,7 @@ impl<T> [T] { | |||
assert_unsafe_precondition!( | |||
check_language_ub, | |||
"slice::as_chunks_unchecked requires `N != 0` and the slice to split exactly into `N`-element chunks", | |||
(n: usize = N, len: usize = self.len()) => n != 0 && len.is_multiple_of(n), | |||
(n: usize = N, len: usize = self.len()) => n != 0 && len % n == 0, |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Is this an intentional change or the effect of a mis-merge?
library/core/src/slice/mod.rs
Outdated
/// Returns a subslice with the optional prefix removed. | ||
/// | ||
/// If the slice starts with `prefix`, returns the subslice after the prefix. If `prefix` | ||
/// is empty or the slice does not start with `prefix`, simply returns the original slice. | ||
/// If `prefix` is equal to the original slice, returns an empty slice. | ||
/// | ||
/// # Examples | ||
/// | ||
/// ``` | ||
/// #![feature(trim_prefix_suffix)] |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Looks like a merge having gone wrong? I don't think this piece should be removed.
library/core/src/slice/mod.rs
Outdated
#[rustc_const_unstable(feature = "const_default", issue = "67792")] | ||
impl<T> const Default for &[T] { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Mis-merge?
Yes those were definitely the result of a mis-merge; it sohuld be fixed now |
Towards solving #19
This PR adds harnesses and contracts for align_to() and align_to_mut(). For the contract for align_to_mut(), we're using a wrapper and writing a contract for that instead, due to model-checking/kani#3764.
By submitting this pull request, I confirm that my contribution is made under the terms of the Apache 2.0 and MIT licenses.