Would something like this works?
panic!("{} - {named:?} - {:?} - {other}", 0, named = return 42, 1, other = 2);
// converted into
{
#[inline(never)]
#[cold]
fn panic(
__arg1: impl ::core::fmt::Display,
named: impl ::core::fmt::Debug,
__arg2: impl ::core::fmt::Debug,
other: impl ::core::fmt::Display
) -> ! {
::core::panicking::panic_fmt(
format_args!("{} - {named:?} - {:?} - {other}", __arg1, named = named, __arg2, other = other)
);
}
panic(0, return 42, 1, 2);
}
EDIT: Ok, it seems that's more or less what someone tried to do in #115562, but also taking constness in account. So I guess we just need to wait #115562 to be resolved.