Add a method to create an arbitrary OpTy from outside rustc_mir#61718
Add a method to create an arbitrary OpTy from outside rustc_mir#61718bjorn3 wants to merge 1 commit intorust-lang:masterfrom
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.
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.
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.
Really the advice here should be "do not use this, period". This is not an inside-rustc vs outside-rustc distinction.
| } | ||
|
|
||
| /// 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.
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.