aboutsummaryrefslogtreecommitdiff
path: root/gcc/rust
diff options
context:
space:
mode:
authorJakub Dupak <dev@jakubdupak.com>2022-11-06 21:21:34 +0100
committerJakub Dupak <dev@jakubdupak.com>2022-11-16 16:26:46 +0100
commit20bf6802ba7b964ec1e570dd4fec971fa3d678f6 (patch)
tree3ffb51b3e043653d9770cfd3c2f1510f5166ee03 /gcc/rust
parent0eaaeb4b3592075fe30d3a8aa57941dd40c6f256 (diff)
downloadgcc-20bf6802ba7b964ec1e570dd4fec971fa3d678f6.zip
gcc-20bf6802ba7b964ec1e570dd4fec971fa3d678f6.tar.gz
gcc-20bf6802ba7b964ec1e570dd4fec971fa3d678f6.tar.bz2
ast: Dump raw pointer type
Signed-off-by: Jakub Dupak <dev@jakubdupak.com>
Diffstat (limited to 'gcc/rust')
-rw-r--r--gcc/rust/ast/rust-ast-dump.cc30
1 files changed, 27 insertions, 3 deletions
diff --git a/gcc/rust/ast/rust-ast-dump.cc b/gcc/rust/ast/rust-ast-dump.cc
index 273a510..e6d6e07 100644
--- a/gcc/rust/ast/rust-ast-dump.cc
+++ b/gcc/rust/ast/rust-ast-dump.cc
@@ -1588,12 +1588,36 @@ Dump::visit (NeverType &)
{}
void
-Dump::visit (RawPointerType &)
-{}
+Dump::visit (RawPointerType &type)
+{
+ // Syntax:
+ // * ( mut | const ) TypeNoBounds
+
+ if (type.get_pointer_type () == RawPointerType::MUT)
+ stream << "*mut ";
+ else /* RawPointerType::CONST */
+ stream << "*const ";
+
+ visit (type.get_type_pointed_to ());
+}
void
Dump::visit (ReferenceType &type)
{
+ // Syntax:
+ // & Lifetime? mut? TypeNoBounds
+
+ stream << '&';
+
+ if (type.has_lifetime ())
+ {
+ visit (type.get_lifetime ());
+ stream << ' ';
+ }
+
+ if (type.get_has_mut ())
+ stream << "mut ";
+
visit (type.get_type_referenced ());
}
@@ -1606,7 +1630,7 @@ Dump::visit (ArrayType &type)
stream << '[';
visit (type.get_elem_type ());
stream << "; ";
- visit(type.get_size_expr());
+ visit (type.get_size_expr ());
stream << ']';
}