diff --git a/llvm/include/llvm/Demangle/RustDemangle.h b/llvm/include/llvm/Demangle/RustDemangle.h --- a/llvm/include/llvm/Demangle/RustDemangle.h +++ b/llvm/include/llvm/Demangle/RustDemangle.h @@ -89,6 +89,7 @@ void demangleGenericArg(); void demangleType(); void demangleFnSig(); + void demangleDynBounds(); void demangleBinder(); void demangleConst(); void demangleConstInt(); diff --git a/llvm/lib/Demangle/RustDemangle.cpp b/llvm/lib/Demangle/RustDemangle.cpp --- a/llvm/lib/Demangle/RustDemangle.cpp +++ b/llvm/lib/Demangle/RustDemangle.cpp @@ -480,6 +480,17 @@ case 'F': demangleFnSig(); break; + case 'D': + demangleDynBounds(); + if (consumeIf('L')) { + if (auto Lifetime = parseBase62Number()) { + print(" + "); + printLifetime(Lifetime); + } + } else { + Error = true; + } + break; default: Position = Start; demanglePath(rust_demangle::InType::Yes); @@ -529,6 +540,16 @@ } } +// = [] {} "E" +void Demangler::demangleDynBounds() { + SwapAndRestore SaveBoundLifetimes(BoundLifetimes, BoundLifetimes); + print("dyn "); + demangleBinder(); + // FIXME demangle {dyn-trait} + if (!consumeIf('E')) + Error = true; +} + // Demangles optional binder and updates the number of bound lifetimes. // // = ["G" ] diff --git a/llvm/test/Demangle/rust.test b/llvm/test/Demangle/rust.test --- a/llvm/test/Demangle/rust.test +++ b/llvm/test/Demangle/rust.test @@ -232,6 +232,22 @@ CHECK: function:: _RIC8functionFUK21C_cmse_nonsecure_callEuE +; Trait objects + +CHECK: trait:: + _RIC5traitDEL_E + +CHECK: trait:: > + _RIC5traitDG_EL_E + +CHECK: trait:: fn(dyn for<'b> + 'a)> + _RIC5traitFG_DG_EL0_EuE + +; Invalid trait object, missing lifetime. + +CHECK: _RIC5traitDEE + _RIC5traitDEE + ; Binders CHECK: binders:: fn(&'a _)>