From c64ab163ba8cb346e28933a88d9084b608fd5a23 Mon Sep 17 00:00:00 2001 From: Pavel Grigorenko Date: Sun, 29 Mar 2026 02:21:53 +0300 Subject: [PATCH 1/5] set edition to 2015 explicitly --- Cargo.toml | 1 + crates/capi/Cargo.toml | 1 + crates/native-c/Cargo.toml | 1 + 3 files changed, 3 insertions(+) diff --git a/Cargo.toml b/Cargo.toml index af6fe2a..1605baa 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -1,6 +1,7 @@ [package] name = "rustc-demangle" version = "0.1.27" +edition = "2015" authors = ["Alex Crichton "] license = "MIT/Apache-2.0" readme = "README.md" diff --git a/crates/capi/Cargo.toml b/crates/capi/Cargo.toml index bafd741..a7e8b67 100644 --- a/crates/capi/Cargo.toml +++ b/crates/capi/Cargo.toml @@ -1,6 +1,7 @@ [package] name = "rustc-demangle-capi" version = "0.1.2" +edition = "2015" authors = ["Torste Aikio "] description = """ C API for the `rustc-demangle` crate diff --git a/crates/native-c/Cargo.toml b/crates/native-c/Cargo.toml index 9575929..8e1ec29 100644 --- a/crates/native-c/Cargo.toml +++ b/crates/native-c/Cargo.toml @@ -1,5 +1,6 @@ [package] name = "rustc-demangle-native-c" +edition = "2015" version = "0.1.0" authors = ["automatically generated"] description = """ From 68603d04dd6f2ca34abc015dab5d43a5004c5d9d Mon Sep 17 00:00:00 2001 From: Pavel Grigorenko Date: Sun, 29 Mar 2026 02:34:38 +0300 Subject: [PATCH 2/5] set MSRV to 1.60 --- Cargo.toml | 1 + crates/capi/Cargo.toml | 1 + crates/native-c/Cargo.toml | 1 + 3 files changed, 3 insertions(+) diff --git a/Cargo.toml b/Cargo.toml index 1605baa..ae3a1ae 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -2,6 +2,7 @@ name = "rustc-demangle" version = "0.1.27" edition = "2015" +rust-version = "1.60.0" authors = ["Alex Crichton "] license = "MIT/Apache-2.0" readme = "README.md" diff --git a/crates/capi/Cargo.toml b/crates/capi/Cargo.toml index a7e8b67..191d9a9 100644 --- a/crates/capi/Cargo.toml +++ b/crates/capi/Cargo.toml @@ -2,6 +2,7 @@ name = "rustc-demangle-capi" version = "0.1.2" edition = "2015" +rust-version = "1.60.0" authors = ["Torste Aikio "] description = """ C API for the `rustc-demangle` crate diff --git a/crates/native-c/Cargo.toml b/crates/native-c/Cargo.toml index 8e1ec29..463c522 100644 --- a/crates/native-c/Cargo.toml +++ b/crates/native-c/Cargo.toml @@ -2,6 +2,7 @@ name = "rustc-demangle-native-c" edition = "2015" version = "0.1.0" +rust-version = "1.60.0" authors = ["automatically generated"] description = """ Native C version of the rustc_demangle crate From 44c1f02045405840a811430fd2456731b17eb7bc Mon Sep 17 00:00:00 2001 From: Pavel Grigorenko Date: Sun, 29 Mar 2026 02:10:50 +0300 Subject: [PATCH 3/5] impl Error for TryDemangleError --- src/lib.rs | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/src/lib.rs b/src/lib.rs index cafec2f..d28f159 100644 --- a/src/lib.rs +++ b/src/lib.rs @@ -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. /// From edc0d3e210b763413dff46c53d477e944d281f5f Mon Sep 17 00:00:00 2001 From: Pavel Grigorenko Date: Sun, 29 Mar 2026 02:45:42 +0300 Subject: [PATCH 4/5] fix `mismatched_lifetime_syntaxes` --- src/legacy.rs | 2 +- src/lib.rs | 4 ++-- src/v0.rs | 2 +- 3 files changed, 4 insertions(+), 4 deletions(-) diff --git a/src/legacy.rs b/src/legacy.rs index d55f3a1..9701548 100644 --- a/src/legacy.rs +++ b/src/legacy.rs @@ -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. diff --git a/src/lib.rs b/src/lib.rs index d28f159..2b32577 100644 --- a/src/lib.rs +++ b/src/lib.rs @@ -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. @@ -243,7 +243,7 @@ impl std::error::Error for 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 { +pub fn try_demangle(s: &str) -> Result, TryDemangleError> { let sym = demangle(s); if sym.style.is_some() { Ok(sym) diff --git a/src/v0.rs b/src/v0.rs index 0f05d3b..03a4223 100644 --- a/src/v0.rs +++ b/src/v0.rs @@ -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. From 7a9bedd2902ec796cfba9150864c3d7b4ecfd4cb Mon Sep 17 00:00:00 2001 From: Pavel Grigorenko Date: Sun, 29 Mar 2026 02:51:08 +0300 Subject: [PATCH 5/5] set `native-c` MSRV to 1.77 --- crates/native-c/Cargo.toml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/crates/native-c/Cargo.toml b/crates/native-c/Cargo.toml index 463c522..276607b 100644 --- a/crates/native-c/Cargo.toml +++ b/crates/native-c/Cargo.toml @@ -2,7 +2,7 @@ name = "rustc-demangle-native-c" edition = "2015" version = "0.1.0" -rust-version = "1.60.0" +rust-version = "1.77.0" authors = ["automatically generated"] description = """ Native C version of the rustc_demangle crate