aboutsummaryrefslogtreecommitdiff
path: root/gcc/rust/resolve/rust-ast-resolve.cc
diff options
context:
space:
mode:
authorPhilip Herron <philip.herron@embecosm.com>2021-11-16 17:05:40 +0000
committerPhilip Herron <philip.herron@embecosm.com>2021-11-17 16:16:20 +0000
commit2547e60d2fca2a323a1b16e04c595aeeec598bc1 (patch)
tree13db0ace4e0315564d028ac4f8c77c31661a2e3e /gcc/rust/resolve/rust-ast-resolve.cc
parent5514d9cec51d5ec7cc30dd6cdbfadfdddbe0aab3 (diff)
downloadgcc-2547e60d2fca2a323a1b16e04c595aeeec598bc1.zip
gcc-2547e60d2fca2a323a1b16e04c595aeeec598bc1.tar.gz
gcc-2547e60d2fca2a323a1b16e04c595aeeec598bc1.tar.bz2
Fix ICE assertion on bad duplicate name
This fixes the ice for TypeNoBounds canonical paths for reference types which was not implemented resulting in empty paths for the canonical path of impl_blocks for example. A Fixme has been added to point out that we should update this interface to only take AST::TypeNoBounds. Fixes #808
Diffstat (limited to 'gcc/rust/resolve/rust-ast-resolve.cc')
-rw-r--r--gcc/rust/resolve/rust-ast-resolve.cc18
1 files changed, 18 insertions, 0 deletions
diff --git a/gcc/rust/resolve/rust-ast-resolve.cc b/gcc/rust/resolve/rust-ast-resolve.cc
index 921b77c..45daa02 100644
--- a/gcc/rust/resolve/rust-ast-resolve.cc
+++ b/gcc/rust/resolve/rust-ast-resolve.cc
@@ -481,6 +481,24 @@ ResolveTypeToCanonicalPath::visit (AST::TypePathSegment &seg)
result = result.append (ident_seg);
}
+void
+ResolveTypeToCanonicalPath::visit (AST::ReferenceType &ref)
+{
+ auto inner_type
+ = ResolveTypeToCanonicalPath::resolve (*ref.get_type_referenced ().get (),
+ include_generic_args_flag,
+ type_resolve_generic_args_flag);
+
+ std::string segment_string ("&");
+ if (ref.get_has_mut ())
+ segment_string += "mut ";
+
+ segment_string += inner_type.get ();
+
+ auto ident_seg = CanonicalPath::new_seg (ref.get_node_id (), segment_string);
+ result = result.append (ident_seg);
+}
+
// rust-ast-resolve-expr.h
void