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 @@ -90,6 +90,7 @@ void demangleType(); void demangleFnSig(); void demangleDynBounds(); + void demangleDynTrait(); void demangleOptionalBinder(); 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 @@ -545,9 +545,18 @@ SwapAndRestore SaveBoundLifetimes(BoundLifetimes, BoundLifetimes); print("dyn "); demangleOptionalBinder(); - // FIXME demangle {dyn-trait} - if (!consumeIf('E')) - Error = true; + for (size_t I = 0; !Error && !consumeIf('E'); ++I) { + if (I > 0) + print(" + "); + demangleDynTrait(); + } +} + +// = {} +// = "p" +void Demangler::demangleDynTrait() { + demanglePath(InType::Yes); + // FIXME demangle {} } // Demangles optional binder and updates the number of bound lifetimes. 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 @@ -243,6 +243,15 @@ CHECK: trait:: fn(dyn for<'b> + 'a)> _RIC5traitFG_DG_EL0_EuE +CHECK: trait:: + _RIC5traitDC7DisplayEL_E + +CHECK: trait:: + _RIC5traitDC7DisplayC4SendC4SyncEL_E + +CHECK: trait:: Display> + _RIC5traitDG_C7DisplayEL_E + ; Invalid trait object, missing lifetime. CHECK: _RIC5traitDEE