Skip to content
Open
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
2 changes: 2 additions & 0 deletions Cargo.toml
Original file line number Diff line number Diff line change
@@ -1,6 +1,8 @@
[package]
name = "rustc-demangle"
version = "0.1.27"
edition = "2015"
rust-version = "1.60.0"
authors = ["Alex Crichton <alex@alexcrichton.com>"]
license = "MIT/Apache-2.0"
readme = "README.md"
Expand Down
2 changes: 2 additions & 0 deletions crates/capi/Cargo.toml
Original file line number Diff line number Diff line change
@@ -1,6 +1,8 @@
[package]
name = "rustc-demangle-capi"
version = "0.1.2"
edition = "2015"
rust-version = "1.60.0"
authors = ["Torste Aikio <zokier@gmail.com>"]
description = """
C API for the `rustc-demangle` crate
Expand Down
2 changes: 2 additions & 0 deletions crates/native-c/Cargo.toml
Original file line number Diff line number Diff line change
@@ -1,6 +1,8 @@
[package]
name = "rustc-demangle-native-c"
edition = "2015"
version = "0.1.0"
rust-version = "1.77.0"
authors = ["automatically generated"]
description = """
Native C version of the rustc_demangle crate
Expand Down
2 changes: 1 addition & 1 deletion src/legacy.rs
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,7 @@ pub struct Demangle<'a> {
// Note that this demangler isn't quite as fancy as it could be. We have lots
// of other information in our symbols like hashes, version, type information,
// etc. Additionally, this doesn't handle glue symbols at all.
pub fn demangle(s: &str) -> Result<(Demangle, &str), ()> {
pub fn demangle(s: &str) -> Result<(Demangle<'_>, &str), ()> {
// First validate the symbol. If it doesn't look like anything we're
// expecting, we just print it literally. Note that we must handle non-Rust
// symbols because we could have any function in the backtrace.
Expand Down
13 changes: 11 additions & 2 deletions src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -89,7 +89,7 @@ enum DemangleStyle<'a> {
/// assert_eq!(demangle("_ZN3foo3barE").to_string(), "foo::bar");
/// assert_eq!(demangle("foo").to_string(), "foo");
/// ```
pub fn demangle(mut s: &str) -> Demangle {
pub fn demangle(mut s: &str) -> Demangle<'_> {
// During ThinLTO LLVM may import and rename internal symbols, so strip out
// those endings first as they're one of the last manglings applied to symbol
// names.
Expand Down Expand Up @@ -220,6 +220,15 @@ pub struct TryDemangleError {
_priv: (),
}

impl fmt::Display for TryDemangleError {
fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result {
write!(f, "TryDemangleError")
}
}

#[cfg(feature = "std")]
impl std::error::Error for TryDemangleError {}

/// The same as `demangle`, except return an `Err` if the string does not appear
/// to be a Rust symbol, rather than "demangling" the given string as a no-op.
///
Expand All @@ -234,7 +243,7 @@ pub struct TryDemangleError {
/// // While `demangle` will just pass the non-symbol through as a no-op.
/// assert_eq!(rustc_demangle::demangle(not_a_rust_symbol).as_str(), not_a_rust_symbol);
/// ```
pub fn try_demangle(s: &str) -> Result<Demangle, TryDemangleError> {
pub fn try_demangle(s: &str) -> Result<Demangle<'_>, TryDemangleError> {
let sym = demangle(s);
if sym.style.is_some() {
Ok(sym)
Expand Down
2 changes: 1 addition & 1 deletion src/v0.rs
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@ pub enum ParseError {
/// This function will take a **mangled** symbol and return a value. When printed,
/// the de-mangled version will be written. If the symbol does not look like
/// a mangled symbol, the original value will be written instead.
pub fn demangle(s: &str) -> Result<(Demangle, &str), ParseError> {
pub fn demangle(s: &str) -> Result<(Demangle<'_>, &str), ParseError> {
// First validate the symbol. If it doesn't look like anything we're
// expecting, we just print it literally. Note that we must handle non-Rust
// symbols because we could have any function in the backtrace.
Expand Down
Loading