aboutsummaryrefslogtreecommitdiff
path: root/absl/debugging/internal/demangle_rust.cc
diff options
context:
space:
mode:
authorChris Mihelich <cmihelic@google.com>2024-05-21 15:54:34 -0700
committerCopybara-Service <copybara-worker@google.com>2024-05-21 15:55:28 -0700
commita2625a648dc69c5b3d0330f25004454716cacfc8 (patch)
tree89e63a05d581fc93392a08e4759dcc1fcaeb690b /absl/debugging/internal/demangle_rust.cc
parent7a730c1b22702b931431c84fe8e42b9c4b0051a0 (diff)
downloadabseil-a2625a648dc69c5b3d0330f25004454716cacfc8.tar.gz
abseil-a2625a648dc69c5b3d0330f25004454716cacfc8.tar.bz2
abseil-a2625a648dc69c5b3d0330f25004454716cacfc8.zip
Recognize inherent-impl and trait-impl in Rust demangling.
PiperOrigin-RevId: 635955480 Change-Id: I9322b4e7732e252007f6ca6c9b0cefc25974c9f8
Diffstat (limited to 'absl/debugging/internal/demangle_rust.cc')
-rw-r--r--absl/debugging/internal/demangle_rust.cc39
1 files changed, 37 insertions, 2 deletions
diff --git a/absl/debugging/internal/demangle_rust.cc b/absl/debugging/internal/demangle_rust.cc
index 20b812a4..83fec2d9 100644
--- a/absl/debugging/internal/demangle_rust.cc
+++ b/absl/debugging/internal/demangle_rust.cc
@@ -151,8 +151,8 @@ class RustSymbolParser {
path:
switch (Take()) {
case 'C': goto crate_root;
- case 'M': return false; // inherent-impl not yet implemented
- case 'X': return false; // trait-impl not yet implemented
+ case 'M': goto inherent_impl;
+ case 'X': goto trait_impl;
case 'Y': goto trait_definition;
case 'N': goto nested_path;
case 'I': goto generic_args;
@@ -165,6 +165,35 @@ class RustSymbolParser {
if (!ParseIdentifier()) return false;
continue;
+ // inherent-impl -> M impl-path type (M already consumed)
+ inherent_impl:
+ if (!Emit("<")) return false;
+ ABSL_DEMANGLER_RECURSE(impl_path, kInherentImplType);
+ ABSL_DEMANGLER_RECURSE(type, kInherentImplEnding);
+ if (!Emit(">")) return false;
+ continue;
+
+ // trait-impl -> X impl-path type path (X already consumed)
+ trait_impl:
+ if (!Emit("<")) return false;
+ ABSL_DEMANGLER_RECURSE(impl_path, kTraitImplType);
+ ABSL_DEMANGLER_RECURSE(type, kTraitImplInfix);
+ if (!Emit(" as ")) return false;
+ ABSL_DEMANGLER_RECURSE(path, kTraitImplEnding);
+ if (!Emit(">")) return false;
+ continue;
+
+ // impl-path -> disambiguator? path (but never print it!)
+ impl_path:
+ ++silence_depth_;
+ {
+ int ignored_disambiguator;
+ if (!ParseDisambiguator(ignored_disambiguator)) return false;
+ }
+ ABSL_DEMANGLER_RECURSE(path, kImplPathEnding);
+ --silence_depth_;
+ continue;
+
// trait-definition -> Y type path (Y already consumed)
trait_definition:
if (!Emit("<")) return false;
@@ -407,6 +436,12 @@ class RustSymbolParser {
kVendorSpecificSuffix,
kIdentifierInUppercaseNamespace,
kIdentifierInLowercaseNamespace,
+ kInherentImplType,
+ kInherentImplEnding,
+ kTraitImplType,
+ kTraitImplInfix,
+ kTraitImplEnding,
+ kImplPathEnding,
kTraitDefinitionInfix,
kTraitDefinitionEnding,
kArraySize,