You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
write_mir_pretty no longer works for non local def_ids #81200
The expect_local call here means that write_mir_pretty no longer works for non local def_ids. The ability to print out MIR for non local functions this way is critical for the MIRAI project.
I think what we can do is to check is_const_fn_raw for the const fn path, and use tcx.instance_mir(ty::InstanceDef::Item(def_id)) if it is not a const fn, as instance_mir already does the correct dispatching for anything that is not a const fn.
If you need any help, don't hesitate to ask here or ping me on zulip. I'll respond whenever I have time (which is a bit flaky this week, but you should definitely get a response once a day)
The only way I know of how to do this is to write something that uses the compiler driver, see for example: https://github.com/rust-lang/rustc-dev-guide/tree/master/examples. That seems like quite a lot of trouble to go to. More ideal would be some kind of unit test, but I have no idea of how that may be accomplished.
Perhaps the easiest way to do an ad hoc test would be to build MIRAI with the latest nightly (I'd have to put up a branch that has been ported to it) and then run its tests.
I've uploaded a draft PR to facebookexperimental/MIRAI#754. If you build that with a recent nightly and then run cargo test, you should see failures. If your fix is good, then all tests should pass.
Thanks @hermanventer, that's very helpful. I was able to run the tests successfully using the master branch, but if I use my stage 1 build with your branch some of the tests fail, and the backtraces include write_mir_pretty so I'm guessing those failing tests are reproducers for this issue.
Activity
RalfJung commentedon Jan 20, 2021
Cc @oli-obk
oli-obk commentedon Jan 20, 2021
I think what we can do is to check
is_const_fn_rawfor theconst fnpath, and usetcx.instance_mir(ty::InstanceDef::Item(def_id))if it is not a const fn, asinstance_miralready does the correct dispatching for anything that is not a const fn.0xPoe commentedon Feb 2, 2021
Can I working on this?
hermanventer commentedon Feb 2, 2021
That would be great. This is a blocker for me.
oli-obk commentedon Feb 2, 2021
It's all yours! You can use
@rustbot claimto have the bot assign it to you0xPoe commentedon Feb 2, 2021
@rustbot claim
oli-obk commentedon Feb 2, 2021
If you need any help, don't hesitate to ask here or ping me on zulip. I'll respond whenever I have time (which is a bit flaky this week, but you should definitely get a response once a day)
0xPoe commentedon Feb 7, 2021
Sorry, I haven't had time to finish it lately. Let's see if others can help.
osa1 commentedon Feb 9, 2021
Do we have a reproducer for this issue? I have some idea of what needs to be done here, but I don't know how to check if it really works.
hermanventer commentedon Feb 9, 2021
The only way I know of how to do this is to write something that uses the compiler driver, see for example: https://github.com/rust-lang/rustc-dev-guide/tree/master/examples. That seems like quite a lot of trouble to go to. More ideal would be some kind of unit test, but I have no idea of how that may be accomplished.
Perhaps the easiest way to do an ad hoc test would be to build MIRAI with the latest nightly (I'd have to put up a branch that has been ported to it) and then run its tests.
hermanventer commentedon Feb 9, 2021
I've uploaded a draft PR to facebookexperimental/MIRAI#754. If you build that with a recent nightly and then run cargo test, you should see failures. If your fix is good, then all tests should pass.
osa1 commentedon Feb 10, 2021
Thanks @hermanventer, that's very helpful. I was able to run the tests successfully using the master branch, but if I use my stage 1 build with your branch some of the tests fail, and the backtraces include
write_mir_prettyso I'm guessing those failing tests are reproducers for this issue.Rollup merge of rust-lang#81965 - osa1:issue81200, r=oli-obk