Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@ rustc-demangle = "0.1.24"
serde = { version = "1.0", optional = true, features = ['derive'] }

# Optionally demangle C++ frames' symbols in backtraces.
cpp_demangle = { default-features = false, version = "0.4.0", optional = true, features = [
cpp_demangle = { default-features = false, version = "0.5.0", optional = true, features = [
"alloc",
] }

Expand Down
14 changes: 8 additions & 6 deletions src/symbolize/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -373,8 +373,13 @@ impl<'a> fmt::Display for SymbolName<'a> {

#[cfg(feature = "cpp_demangle")]
{
// This may fail to print if the demangled symbol isn't actually
// valid, so handle the error here gracefully by not propagating
// it outwards.
if let Some(ref cpp) = self.cpp_demangled.0 {
return cpp.fmt(f);
if let Ok(s) = cpp.demangle() {
return s.fmt(f);
}
}
}

Expand All @@ -390,14 +395,11 @@ impl<'a> fmt::Debug for SymbolName<'a> {

#[cfg(all(feature = "std", feature = "cpp_demangle"))]
{
use std::fmt::Write;

// This may to print if the demangled symbol isn't actually
// This may fail to print if the demangled symbol isn't actually
// valid, so handle the error here gracefully by not propagating
// it outwards.
if let Some(ref cpp) = self.cpp_demangled.0 {
let mut s = String::new();
if write!(s, "{cpp}").is_ok() {
if let Ok(s) = cpp.demangle() {
return s.fmt(f);
}
}
Expand Down
Loading