From d755769bd15209193d1c178862ed3e01ba5c3d9d Mon Sep 17 00:00:00 2001 From: Philip Herron Date: Fri, 15 Oct 2021 18:02:51 +0100 Subject: 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 --- gcc/rust/hir/tree/rust-hir-path.h | 5 +++++ 1 file changed, 5 insertions(+) (limited to 'gcc/rust/hir') 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 -- cgit v1.1