aboutsummaryrefslogtreecommitdiff
path: root/gcc/rust/hir
diff options
context:
space:
mode:
authorPhilip Herron <philip.herron@embecosm.com>2021-10-15 18:02:51 +0100
committerPhilip Herron <philip.herron@embecosm.com>2021-10-22 10:34:31 +0100
commitd755769bd15209193d1c178862ed3e01ba5c3d9d (patch)
treede4344d1cd0cfc3204cd0816fdf2678c02a52896 /gcc/rust/hir
parenta80bcfc5b1cb471d904ae9135256d9d0b0d77cd4 (diff)
downloadgcc-d755769bd15209193d1c178862ed3e01ba5c3d9d.zip
gcc-d755769bd15209193d1c178862ed3e01ba5c3d9d.tar.gz
gcc-d755769bd15209193d1c178862ed3e01ba5c3d9d.tar.bz2
BugFix: TypePath resolution to handle associated types
TypePath's can be fully resolved at name resolution time for example a primitive types are single segments which can be resolved. But in the event of a generic TypeBound path such as: T::A where T is the generic type param in a function and A is its own associated type this require's the resolution to be split over the name resolver and type resolver. Like PathInExpression's the name resolver is able to resolve the root segment of 'T' but requires a path probe on the type-bounds of T to find the associated type 'A'. Fixes #746
Diffstat (limited to 'gcc/rust/hir')
-rw-r--r--gcc/rust/hir/tree/rust-hir-path.h5
1 files changed, 5 insertions, 0 deletions
diff --git a/gcc/rust/hir/tree/rust-hir-path.h b/gcc/rust/hir/tree/rust-hir-path.h
index 13e246f..a04398e 100644
--- a/gcc/rust/hir/tree/rust-hir-path.h
+++ b/gcc/rust/hir/tree/rust-hir-path.h
@@ -420,6 +420,11 @@ public:
const Analysis::NodeMapping &get_mappings () const { return mappings; }
const PathIdentSegment &get_ident_segment () const { return ident_segment; }
+
+ bool is_generic_segment () const
+ {
+ return get_type () == SegmentType::GENERIC;
+ }
};
// Segment used in type path with generic args