macro_rules! func_name {
    () => { ... };
}
Expand description

Returns the name of the function where the macro is invoked. Returns a &'static str.

§Note

This is intended for diagnostic use and the exact output is not guaranteed. It provides a best-effort description, but the output may change between versions of the compiler.

In short: use this for debugging, avoid using the output to affect program behavior.

§Examples

let current_function_name = unwind_context::func_name!();
println!("defined in function: {current_function_name}");