Skip to content

Commit

Permalink
offset_from intrinsic: always allow pointers to point to the same add…
Browse files Browse the repository at this point in the history
…ress
  • Loading branch information
RalfJung committed Jul 6, 2024
1 parent 725c9a6 commit 96fb8a7
Showing 1 changed file with 0 additions and 3 deletions.
3 changes: 0 additions & 3 deletions tests/pass/zero-sized-accesses-and-offsets.rs
Original file line number Diff line number Diff line change
Expand Up @@ -39,8 +39,6 @@ fn test_ptr(ptr: *mut ()) {
// Distance.
let ptr = ptr.cast::<i32>();
ptr.offset_from(ptr);
/*
FIXME: this is disabled for now as these cases are not yet allowed.
// Distance from other "bad" pointers that have the same address, but different provenance. Some
// of this is library UB, but we don't want it to be language UB since that would violate
// provenance monotonicity: if we allow computing the distance between two ptrs with no
Expand All @@ -54,6 +52,5 @@ fn test_ptr(ptr: *mut ()) {
// - Distance from use-after-free pointer
drop(b);
ptr.offset_from(other_ptr.with_addr(ptr.addr()));
*/
}
}

0 comments on commit 96fb8a7

Please sign in to comment.