-
Notifications
You must be signed in to change notification settings - Fork 12.9k
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
fix Miri offset_from #66083
fix Miri offset_from #66083
Conversation
r? @varkor (rust_highfive has picked a reviewer for you, use r? to override) |
This PR fixes https://github.com/RalfJung/miri-test-libstd, which currently fails. |
r? @oli-obk |
let b = self.read_immediate(args[1])?.to_scalar()?; | ||
|
||
// Special case: if both scalars are *equal integers* | ||
// and not NULL, their offset is 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.
why is the null case important? The docs state nothing of the kind. Or is the "valid object" thing the problem?
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.
Actually, since wrapping_offset_from
is safe, and you can supply null pointers to it... I guess this should be allowed?
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.
Indeed this is about the "valid object" part. There's never a valid object at 0, not even one of size 0, so 0 is never a valid input here.
wrapping_offset_from
does not have the "valid object" requirement.
@bors r=oli-obk p=1 |
📌 Commit a593b54 has been approved by |
fix Miri offset_from This is needed to make rust-lang/miri#1032 pass.
☀️ Test successful - checks-azure |
test offset_from This currently fails and needs a rustc fix: rust-lang/rust#66083
This is needed to make rust-lang/miri#1032 pass.