-
Notifications
You must be signed in to change notification settings - Fork 13.3k
Add a method to create an arbitrary OpTy from outside rustc_mir #61718
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
Conversation
0a38eb4
to
5ee6f8a
Compare
{ | ||
/// This is used by [priroda](https://github.com/oli-obk/priroda) to create an `OpTy`. | ||
/// | ||
/// Do not use this from inside rustc. |
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.
Can you expand a bit on why this shouldn't be used from inside rustc? Is it just that this operation is unchecked or does it violate some other assumption?
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.
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.
The *Ty
types have successfully found and prevent several bugs. Currently the only "hole" in the scheme is ImmTy
, you can construct arbitrary immediates from the outside. I was very happy when I managed to make OpTy
private and only expose ImmTy
instead, having to un-do this would be very sad. :(
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.
Really the advice here should be "do not use this, period". This is not an inside-rustc vs outside-rustc distinction.
@@ -395,7 +405,6 @@ impl<'a, 'mir, 'tcx, M: Machine<'a, 'mir, 'tcx>> InterpretCx<'a, 'mir, 'tcx, M> | |||
}) | |||
} | |||
|
|||
/// This is used by [priroda](https://github.com/oli-obk/priroda) to get an OpTy from a local | |||
pub fn access_local( |
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.
Does that mean we can make the method private?
Looking at that, what about making |
That's possible. |
I'd strongly prefer that. |
Closing in favour of making |
r? @oli-obk
This is necessary to make priroda work again without the ugly catch panic hack at https://github.com/oli-obk/priroda/blob/0810d79b474f6ad66686c664925fd595f011c581/src/render/locals.rs#L39-L54.