File tree Expand file tree Collapse file tree 2 files changed +8
-1
lines changed Expand file tree Collapse file tree 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};
77use crate :: marker:: PhantomData ;
88use crate :: num:: fmt as numfmt;
99use crate :: ops:: Deref ;
10- use crate :: { iter, result, str} ;
10+ use crate :: { iter, mem , result, str} ;
1111
1212mod builders;
1313#[ cfg( not( no_fp_fmt_parse) ) ]
Original file line number Diff line number Diff line change @@ -72,6 +72,13 @@ macro_rules! argument_new {
7272 // a `fn(&T, ...)`, so the invariant is maintained.
7373 ty: ArgumentType :: Placeholder {
7474 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" ) ) ]
7582 formatter: |ptr: NonNull <( ) >, fmt: & mut Formatter <' _>| {
7683 let func = $f;
7784 // SAFETY: This is the same type as the `value` field.
You can’t perform that action at this time.
0 commit comments