cfg(kcfi)
This commit is contained in:
parent
17d412439a
commit
6c6a39e6bf
3 changed files with 18 additions and 9 deletions
|
@ -7,7 +7,7 @@ use crate::char::{EscapeDebugExtArgs, MAX_LEN_UTF8};
|
|||
use crate::marker::PhantomData;
|
||||
use crate::num::fmt as numfmt;
|
||||
use crate::ops::Deref;
|
||||
use crate::{iter, result, str};
|
||||
use crate::{iter, mem, result, str};
|
||||
|
||||
mod builders;
|
||||
#[cfg(not(no_fp_fmt_parse))]
|
||||
|
|
|
@ -72,6 +72,13 @@ macro_rules! argument_new {
|
|||
// a `fn(&T, ...)`, so the invariant is maintained.
|
||||
ty: ArgumentType::Placeholder {
|
||||
value: NonNull::<$t>::from_ref($x).cast(),
|
||||
#[cfg(not(any(sanitize = "cfi", sanitize = "kcfi")))]
|
||||
formatter: {
|
||||
let f: fn(&$t, &mut Formatter<'_>) -> Result = $f;
|
||||
// SAFETY: This is only called with `value`, which has the right type.
|
||||
unsafe { mem::transmute(f) }
|
||||
},
|
||||
#[cfg(any(sanitize = "cfi", sanitize = "kcfi"))]
|
||||
formatter: |ptr: NonNull<()>, fmt: &mut Formatter<'_>| {
|
||||
let func = $f;
|
||||
// SAFETY: This is the same type as the `value` field.
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue