File tree 2 files changed +8
-1
lines changed
2 files changed +8
-1
lines changed Original file line number Diff line number Diff line change @@ -7,7 +7,7 @@ use crate::char::{EscapeDebugExtArgs, MAX_LEN_UTF8};
7
7
use crate :: marker:: PhantomData ;
8
8
use crate :: num:: fmt as numfmt;
9
9
use crate :: ops:: Deref ;
10
- use crate :: { iter, result, str} ;
10
+ use crate :: { iter, mem , result, str} ;
11
11
12
12
mod builders;
13
13
#[ cfg( not( no_fp_fmt_parse) ) ]
Original file line number Diff line number Diff line change @@ -72,6 +72,13 @@ macro_rules! argument_new {
72
72
// a `fn(&T, ...)`, so the invariant is maintained.
73
73
ty: ArgumentType :: Placeholder {
74
74
value: NonNull :: <$t>:: from_ref( $x) . cast( ) ,
75
+ #[ cfg( not( any( sanitize = "cfi" , sanitize = "kcfi" ) ) ) ]
76
+ formatter: {
77
+ let f: fn ( & $t, & mut Formatter <' _>) -> Result = $f;
78
+ // SAFETY: This is only called with `value`, which has the right type.
79
+ unsafe { mem:: transmute( f) }
80
+ } ,
81
+ #[ cfg( any( sanitize = "cfi" , sanitize = "kcfi" ) ) ]
75
82
formatter: |ptr: NonNull <( ) >, fmt: & mut Formatter <' _>| {
76
83
let func = $f;
77
84
// SAFETY: This is the same type as the `value` field.
You can’t perform that action at this time.
0 commit comments