src/librustc_mir/dataflow/impls/borrows.rs why does Terminator::Call not need to call
kill_borrows_on_place() for its destination place, while Statement::Assign does?
I'm trying to understand this code to figure out if I need to add handling for Terminator::InlineAsm, which I am adding.
cc @ecstatic-morse (@eddyb suggested you might be familiar with this code)
@Amanieu No idea. It seems like it should kill any borrows of the return place in
call_return_effect. This wasn't implemented by me, as the semantics are unchanged from at least 1.35, which was before I worked on rust. You probably need to ask @pnkfelix.
Is the goal to eventually support unwinding out of
Maybe in the future. The more immediate reason is to support diverging InlineAsm
But you want a "success" edge and an "unwind" edge like
Not really, just a success edge for now.
Here's the MIR part of the PR if you want to have a look: https://github.com/rust-lang/rust/pull/69171/commits/8d3b9ba81e2cebb0d2bc528ea523243723813ef9
If there's only ever one edge out of
InlineAsm, does it need to be converted to a terminator as part of your PR? Or can it remain a statement for now?
I mean, I think it should ultimately be a terminator, but does it save work to make that change now as opposed to later?
Well I'm not using any of the existing InlineAsm code, it's more of a rewrite from scratch.
The old InlineAsm was renamed to LlvmInlineAsm (see first commit)
Since this is a rewrite, I figured it may as well be done properly.
Ah, that's fine. I suspect that there are places where
InlineAsm is not handled correctly in the existing code. I can't help you with
Borrows unfortunately, but feel free to ask about other dataflow places. As long as
InlineAsm only has one outgoing edge it should be pretty much equivalent to the statement version as far as dataflow is concerned.
InlineAsm were to have multiple outgoing edges and the edge that was taken determined which outputs were assigned to, you would need to make changes to the dataflow API.
@pnkfelix Could you have a quick look at
src/librustc_mir/dataflow/impls/borrows.rs? I think
call_return_effect needs to call
self.kill_borrows_on_place, like StatementKind::Assign does, but I'm not very familiar with what the code does.
yeah I'll try to take a look today, thanks for your investigation so far.