gccrs: Ensure uniqueness on Path probe's
authorPhilip Herron <philip.herron@embecosm.com>
Wed, 5 Oct 2022 16:24:26 +0000 (17:24 +0100)
committerArthur Cohen <arthur.cohen@embecosm.com>
Tue, 21 Feb 2023 11:36:32 +0000 (12:36 +0100)
commit31b77593edbf623fb8f84e35baeb927fdd7c55b6
tree083eabe2a4f749680663d53cbb20639186992d46
parent79434fabf762d60b7aa54e2319c44c1610dd8065
gccrs: Ensure uniqueness on Path probe's

When we lookup names in paths such as Foo::bar, foo is a type we resolve
and then we lookup 'bar' based on what type Foo is which includes probing
relevant bounds of this type. We currently return a vector of possible
candidates and this patch changes it so that we return a set of unique
items based on DefId.

Addresses #1555

gcc/rust/ChangeLog:

* backend/rust-compile-expr.cc
(CompileExpr::resolve_method_address): Use auto and minor change
in candidate init.
* typecheck/rust-hir-type-check-path.cc
(TypeCheckExpr::resolve_segments): Likewise.
* typecheck/rust-hir-type-check-type.cc: Likewise.
* backend/rust-compile-resolve-path.cc
(HIRCompileBase::query_compile): Likewise. Removecall to
set_ty_ref.
* typecheck/rust-hir-path-probe.h (struct PathProbeCandidate): Add
locus initializer in ctor, implement get_defid.
(class PathProbeType::Probe): return a set instead of vector.
Adjust class impl.
(class ReportMultipleCandidateError): Do not inherit from
HIRImplVisitor anymore and remove corresponding impl. Adjust for
change in Probe. Simplify Report handling.
(class PathProbeImplTrait::Probe): Adjust return type.
gcc/rust/backend/rust-compile-expr.cc
gcc/rust/backend/rust-compile-resolve-path.cc
gcc/rust/typecheck/rust-hir-path-probe.h
gcc/rust/typecheck/rust-hir-type-check-path.cc
gcc/rust/typecheck/rust-hir-type-check-type.cc