Skip to content

Commit d294ebf

Browse files
committed
Add demangling implementation for the new mangling scheme.
1 parent 84f8a4a commit d294ebf

File tree

2 files changed

+1049
-1
lines changed

2 files changed

+1049
-1
lines changed

src/lib.rs

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -31,6 +31,7 @@
3131
extern crate std;
3232

3333
mod legacy;
34+
mod v0;
3435

3536
use core::fmt;
3637

@@ -43,6 +44,7 @@ pub struct Demangle<'a> {
4344

4445
enum DemangleStyle<'a> {
4546
Legacy(legacy::Demangle<'a>),
47+
V0(v0::Demangle<'a>),
4648
}
4749

4850
/// De-mangles a Rust symbol into a more readable version
@@ -93,7 +95,10 @@ pub fn demangle(mut s: &str) -> Demangle {
9395

9496
let style = match legacy::demangle(s) {
9597
Ok(d) => Some(DemangleStyle::Legacy(d)),
96-
Err(()) => None,
98+
Err(()) => match v0::demangle(s) {
99+
Ok(d) => Some(DemangleStyle::V0(d)),
100+
Err(v0::Invalid) => None,
101+
},
97102
};
98103
Demangle {
99104
style: style,
@@ -174,6 +179,9 @@ impl<'a> fmt::Display for Demangle<'a> {
174179
Some(DemangleStyle::Legacy(ref d)) => {
175180
try!(fmt::Display::fmt(d, f))
176181
}
182+
Some(DemangleStyle::V0(ref d)) => {
183+
try!(fmt::Display::fmt(d, f))
184+
}
177185
}
178186
f.write_str(self.suffix)
179187
}

0 commit comments

Comments
 (0)