Skip to content
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

Enable comparing fat pointers #58301

Merged
merged 4 commits into from
Feb 14, 2019
Merged

Enable comparing fat pointers #58301

merged 4 commits into from
Feb 14, 2019

Conversation

RalfJung
Copy link
Member

@RalfJung RalfJung commented Feb 8, 2019

Also refactor our binops a bit to make that happen more easily.

r? @oli-obk

@rust-highfive rust-highfive added the S-waiting-on-review Status: Awaiting review from the assignee but also interested parties. label Feb 8, 2019

// 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() ||
Copy link
Contributor

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?

Copy link
Member Author

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.

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)?;
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
let layout = self.layout_of(self.tcx.types.usize)?;
let layout = self.layout_of(self.tcx.types.usize)?;

@RalfJung
Copy link
Member Author

RalfJung commented Feb 8, 2019

@bors r=oli-obk

@bors
Copy link
Contributor

bors commented Feb 8, 2019

📌 Commit fd141293def51541872b439a64090c9929653873 has been approved by oli-obk

@bors bors added S-waiting-on-bors Status: Waiting on bors to run and complete tests. Bors will change the label on completion. and removed S-waiting-on-review Status: Awaiting review from the assignee but also interested parties. labels Feb 8, 2019
@bors
Copy link
Contributor

bors commented Feb 9, 2019

☔ The latest upstream changes (presumably #58316) made this pull request unmergeable. Please resolve the merge conflicts.

@bors bors added S-waiting-on-author Status: This is awaiting some action (such as code changes or more information) from the author. and removed S-waiting-on-bors Status: Waiting on bors to run and complete tests. Bors will change the label on completion. labels Feb 9, 2019
@RalfJung
Copy link
Member Author

RalfJung commented Feb 9, 2019

Rebased.

@bors r=oli-obk

@bors
Copy link
Contributor

bors commented Feb 9, 2019

📌 Commit a873d18395c1f90d4ffe13ef28bdbca344115fe9 has been approved by oli-obk

@bors bors added S-waiting-on-bors Status: Waiting on bors to run and complete tests. Bors will change the label on completion. and removed S-waiting-on-author Status: This is awaiting some action (such as code changes or more information) from the author. labels Feb 9, 2019
@RalfJung
Copy link
Member Author

Rebased, to integrate with other Miri-related changes (for easier testing).

@bors r=oli-obk

@bors
Copy link
Contributor

bors commented Feb 13, 2019

📌 Commit 1a5304a has been approved by oli-obk

@rust-highfive

This comment has been minimized.

@RalfJung
Copy link
Member Author

Fixed rebase fallout.

@bors r=oli-obk

@bors
Copy link
Contributor

bors commented Feb 13, 2019

📌 Commit 22d5e6a has been approved by oli-obk

Centril added a commit to Centril/rust that referenced this pull request Feb 14, 2019
Enable comparing fat pointers

Also refactor our binops a bit to make that happen more easily.

r? @oli-obk
Centril added a commit to Centril/rust that referenced this pull request Feb 14, 2019
Enable comparing fat pointers

Also refactor our binops a bit to make that happen more easily.

r? @oli-obk
bors added a commit that referenced this pull request Feb 14, 2019
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
@bors bors merged commit 22d5e6a into rust-lang:master Feb 14, 2019
@RalfJung RalfJung deleted the fat-ptr-eq branch February 17, 2019 11:05
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
S-waiting-on-bors Status: Waiting on bors to run and complete tests. Bors will change the label on completion.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants