In a tail call, before_stack_pop gets called before the stack frame is replaced with that of the new function. This ends the corresponding protectors in Miri, which is premature: they should instead be carried over to the new stack frame, and only ended when we return back to the caller.
This affects both protection of function arguments and, perhaps even more relevant, the return place.
Currently it is hard to write a test case since custom MIR does not yet support tail calls (support is being added in rust-lang/rust#128688).
In a tail call,
before_stack_popgets called before the stack frame is replaced with that of the new function. This ends the corresponding protectors in Miri, which is premature: they should instead be carried over to the new stack frame, and only ended when we return back to the caller.This affects both protection of function arguments and, perhaps even more relevant, the return place.
Currently it is hard to write a test case since custom MIR does not yet support tail calls (support is being added in rust-lang/rust#128688).