1
0
mirror of https://github.com/samba-team/samba.git synced 2025-01-08 21:18:16 +03:00

Fix display of function names in debug

Rust adds some odd `{{closure}}` bits to the
function name that need to be removed, otherwise
the debug is unreadable.

Signed-off-by: David Mulder <dmulder@samba.org>
Reviewed-by: Alexander Bokovoy <ab@samba.org>
This commit is contained in:
David Mulder 2024-08-22 15:23:15 -06:00
parent a72146c4ef
commit 8f8943547b

View File

@ -88,10 +88,15 @@ macro_rules! function {
}
let name = type_name_of(f);
match &name[..name.len() - 3].rfind(':') {
Some(pos) => &name[pos + 1..name.len() - 3],
None => &name[..name.len() - 3],
}
let base_name = match name.rfind("::") {
Some(pos) => &name[..pos],
None => name,
};
let parts: Vec<&str> = base_name
.split("::")
.filter(|&p| p != "{{closure}}")
.collect();
parts.join("::")
}};
}
@ -103,7 +108,7 @@ macro_rules! DBG_PREFIX {
let location_cstr = chelps::wrap_string(&location);
let function = $crate::function!();
let function_msg = format!("{}: ", function);
let function_cstr = chelps::wrap_string(function);
let function_cstr = chelps::wrap_string(&function);
let function_msg_cstr = chelps::wrap_string(&function_msg);
let msg = format!($($arg),*);
let msg_cstr = chelps::wrap_string(&msg);