-
Notifications
You must be signed in to change notification settings - Fork 13.3k
Enable comparing fat pointers #58301
New issue
Have a question about this project? # for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “#”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? # to your account
Conversation
|
||
// Handle operations that support pointer values | ||
if left.is_ptr() || right.is_ptr() || bin_op == mir::BinOp::Offset { | ||
return M::ptr_op(self, bin_op, left, left_layout, right, right_layout); | ||
if left.to_scalar_ptr()?.is_ptr() || |
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.
isn't this problematic for miri? a fat pointer will cause an error here, will it not?
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.
to_scalar_ptr
returns the first component of a scalar pair.
src/librustc_mir/interpret/place.rs
Outdated
let n = *self.frame().locals[local].access()?; | ||
let n_layout = self.layout_of(self.tcx.types.usize)?; | ||
let n = self.read_scalar(OpTy { op: n, layout: n_layout })?; | ||
let layout = self.layout_of(self.tcx.types.usize)?; |
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.
let layout = self.layout_of(self.tcx.types.usize)?; | |
let layout = self.layout_of(self.tcx.types.usize)?; |
@bors r=oli-obk |
📌 Commit fd141293def51541872b439a64090c9929653873 has been approved by |
☔ The latest upstream changes (presumably #58316) made this pull request unmergeable. Please resolve the merge conflicts. |
Rebased. @bors r=oli-obk |
📌 Commit a873d18395c1f90d4ffe13ef28bdbca344115fe9 has been approved by |
Rebased, to integrate with other Miri-related changes (for easier testing). @bors r=oli-obk |
📌 Commit 1a5304a has been approved by |
This comment has been minimized.
This comment has been minimized.
Fixed rebase fallout. @bors r=oli-obk |
📌 Commit 22d5e6a has been approved by |
Enable comparing fat pointers Also refactor our binops a bit to make that happen more easily. r? @oli-obk
Enable comparing fat pointers Also refactor our binops a bit to make that happen more easily. r? @oli-obk
Rollup of 8 pull requests Successful merges: - #57451 (suggestion-diagnostics: as_ref improve snippet) - #57856 (Convert old first edition links to current edition one) - #57992 (Update the future/task API) - #58258 (Reduce the size of `hir::Expr`.) - #58267 (Tweak "incompatible match arms" error) - #58296 (Hidden suggestion support) - #58301 (Enable comparing fat pointers) - #58308 (Extract block to insert an intrinsic into its own function) Failed merges: r? @ghost
Also refactor our binops a bit to make that happen more easily.
r? @oli-obk