-
Notifications
You must be signed in to change notification settings - Fork 13k
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
Give OpTy access to locals for priroda #55179
Conversation
@bors r+ rollup |
📌 Commit 7403d55 has been approved by |
Make OpTy field op public for priroda r? @oli-obk
Oh, why does it need that? I wanted to have something like an abstraction here :( |
We need a way to go from a stackframe ID and a local ID to an OpTy. This seemed the easiest way. Since you have legit concerns here, let's do it right by adding a convenience function for the specific use case. @bors r- |
@bors rollup- |
r? @RalfJung |
Got some errors locally. Fixing... |
Fixed |
let local_ty = self.monomorphize(local_ty, frame.instance.substs); | ||
let layout = self.layout_of(local_ty)?; | ||
Ok(OpTy { op, layout }) | ||
} |
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 don't you use stack()
? locals
is public, so that should give you all you need?
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.
That gives an Operand
while I need an OpTy
which cant be made outside rustc_mir.
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.
Oh I see. In that case, please use layout_of_local
, and please change eval_place_to_operand
to use your new method.
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.
layout_of_local
expects a frame id, while this takes an arbitrary Frame. I can do the other thing though.
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.
And you don't have a frame ID where you need this?
You can change layout_of_local
to take &Frame
as well.
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.
And you don't have a frame ID where you need this?
Currently I do have it, but in the future I want to do some caching for stepping back in time, which could involve printing frames not on the stack. (I am not sure how to do the caching yet, just anticipating.)
You can change layout_of_local to take &Frame as well.
+1
@oli-obk suggested adding another thing to this PR, which I will do tomorrow. |
This is ready for review. |
&self, | ||
frame: &super::Frame<'mir, 'tcx, M::PointerTag>, | ||
local: mir::Local, | ||
layout: Option<TyLayout<'tcx>>, |
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.
Uh, I forgot we already know the layout there sometimes. Exposing this is not nice.
I do not have a good idea for how to avoid it, though.
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.
Layout is also passed to eval_place_to_op
which calls this function now.
@bors r- Sorry I forgot something: Could you add an |
@bors delegate+ r=me with that fixed. |
✌️ @bjorn3 can now approve this pull request |
☔ The latest upstream changes (presumably #55125) made this pull request unmergeable. Please resolve the merge conflicts. |
Also make `layout_of_local` accept any `Frame`
c571a95
to
c32cf25
Compare
@bors r+ |
📌 Commit b178553 has been approved by |
This should have been @bors r=RalfJung |
💡 This pull request was already approved, no need to approve it again.
|
📌 Commit b178553 has been approved by |
Didn't know I had to do it that way. |
It's okay, now you do. :) "r+" means "I did the review and approve". "r=someone" means "I solemnly swear that someone did the review and approved". |
Give OpTy access to locals for priroda r? @oli-obk
☀️ Test successful - status-appveyor, status-travis |
r? @oli-obk