Constructors can appear in the final program when they are passed as function pointers. Example:
use leaf::annotations::Symbolizable;
fn main() {
let x = call_x(X);
if x.0 == 20 {
core::hint::black_box(0);
}
}
struct X(i32);
fn call_x(x: fn(i32) -> X) -> X {
x(5.mark_symbolic())
}
However, as mir_for_ctfe is used to obtain their MIR, they are not instrumented and consequently treated as external functions. Also, overriding mir_for_ctfe is presumably problematic as it is used for constant evaluation as well. It may be possible to avoid the problem using const_eval_select.
rust-lang/rust#131650 seems to make MIR overriding possible at the codegen phase. We can wait for that to add support for everything.
Constructors can appear in the final program when they are passed as function pointers. Example:
However, as
mir_for_ctfeis used to obtain their MIR, they are not instrumented and consequently treated as external functions. Also, overridingmir_for_ctfeis presumably problematic as it is used for constant evaluation as well. It may be possible to avoid the problem usingconst_eval_select.rust-lang/rust#131650 seems to make MIR overriding possible at the codegen phase. We can wait for that to add support for everything.