A code path macro
use code_path::code_path; fn foo() -> &'static str { fn bar() -> &'static str { code_path!() } bar() } assert_eq!(foo(), "rust_out::main::_doctest_main_src_lib_rs_6_0::foo::bar");