Borrowed string getters for DebugCategory are unsafe
The get_description
and get_name
getters for DebugCategory are declared as follows:
pub fn get_name<'a>(self) -> &'a str {
pub fn get_description<'a>(self) -> Option<&'a str> {
This means that the caller can construct a lifetime out of thin air, including 'static, so the lifetime of the borrowed string value is completely unrelated to the underlying string data the it is borrowed from.
It's not clear to me why all of the methods for DebugCategory use self
instead of &self
, but changing that would be one easy way to fix this problem.