File tree Expand file tree Collapse file tree 1 file changed +11
-0
lines changed Expand file tree Collapse file tree 1 file changed +11
-0
lines changed Original file line number Diff line number Diff line change @@ -80,6 +80,17 @@ macro_rules! argument_new {
8080 // To avoid this crash, we use a helper function when CFI is enabled. To avoid the
8181 // cost of this helper function (mainly code-size) when it is not needed, we
8282 // transmute the function pointer otherwise.
83+ //
84+ // This is is similar to what the Rust compiler does internally with vtables when
85+ // CFI is enabled, where it generates trampoline functions that only serve to adjust
86+ // the expected type of the argument. `ArgumentType::Placeholder` is a bit like a
87+ // manually constructed trait object, so it is not surprising that the same approach
88+ // has to be applied here as well.
89+ //
90+ // It is still considered problematic (from the Rust side) that CFI rejects entirely
91+ // legal Rust programs, so we do not consider anything done here a stable guarantee,
92+ // but meanwhile we carry this work-around to keep Rust compatible with CFI
93+ // runtimes.
8394 #[ cfg( not( any( sanitize = "cfi" , sanitize = "kcfi" ) ) ) ]
8495 formatter: {
8596 let f: fn ( & $t, & mut Formatter <' _>) -> Result = $f;
You can’t perform that action at this time.
0 commit comments