-
Notifications
You must be signed in to change notification settings - Fork 88
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
Pointer outside object bounds in iterator examples #559
Comments
This is a smaller example that triggers the same spurious failure: fn main() {
let v: Vec<u8> = vec![5, 5, 5];
for x in v {
assert!(x == 5);
}
} This appears to be caused by CBMC's
but without #[stable(feature = "ptr_offset_from", since = "1.47.0")]
#[rustc_const_unstable(feature = "const_ptr_offset_from", issue = "41079")]
#[inline]
pub const unsafe fn offset_from(self, origin: *const T) -> isize
where
T: Sized,
{
let pointee_size = mem::size_of::<T>();
assert!(0 < pointee_size && pointee_size <= isize::MAX as usize);
// SAFETY: the caller must uphold the safety contract for `ptr_offset_from`.
unsafe { intrinsics::ptr_offset_from(self, origin) } // <--------------------------
} |
This is a duplicate of #556. Both are issues with pointer primitive checks happening inside |
The following code from the "Rust by Example" book:
fails to verify with
Not sure if #356 has anything to do, the error is quite different.
The text was updated successfully, but these errors were encountered: