[committed,083/103] gccrs: ast: Dump trait object type

Message ID 20230221120230.596966-84-arthur.cohen@embecosm.com
State Unresolved
Headers
Series [committed,001/103] gccrs: Fix missing dead code analysis ICE on local enum definition |

Checks

Context Check Description
snail/gcc-patch-check warning Git am fail log

Commit Message

Arthur Cohen Feb. 21, 2023, 12:02 p.m. UTC
  From: Jakub Dupak <dev@jakubdupak.com>

gcc/rust/ChangeLog:

	* ast/rust-ast-dump.cc (Dump::visit): Add missing visitor.

Signed-off-by: Jakub Dupak <dev@jakubdupak.com>
---
 gcc/rust/ast/rust-ast-dump.cc | 17 +++++++++++++----
 1 file changed, 13 insertions(+), 4 deletions(-)
  

Patch

diff --git a/gcc/rust/ast/rust-ast-dump.cc b/gcc/rust/ast/rust-ast-dump.cc
index 1d593d4b749..0ae57fdb744 100644
--- a/gcc/rust/ast/rust-ast-dump.cc
+++ b/gcc/rust/ast/rust-ast-dump.cc
@@ -1618,12 +1618,21 @@  Dump::visit (ImplTraitType &type)
   //    TypeParamBound ( + TypeParamBound )* +?
 
   stream << "impl ";
-  visit_items_joined_by_separator(type.get_type_param_bounds (), " + ");
+  visit_items_joined_by_separator (type.get_type_param_bounds (), " + ");
 }
 
 void
-Dump::visit (TraitObjectType &)
-{}
+Dump::visit (TraitObjectType &type)
+{
+  // Syntax:
+  //   dyn? TypeParamBounds
+  // TypeParamBounds :
+  //   TypeParamBound ( + TypeParamBound )* +?
+
+  if (type.is_dyn ())
+    stream << "dyn ";
+  visit_items_joined_by_separator (type.get_type_param_bounds (), " + ");
+}
 
 void
 Dump::visit (ParenthesisedType &)
@@ -1636,7 +1645,7 @@  Dump::visit (ImplTraitTypeOneBound &type)
   //    impl TraitBound
 
   stream << "impl ";
-  visit (type.get_trait_bound());
+  visit (type.get_trait_bound ());
 }
 
 void