diff options
author | Philip Herron <philip.herron@embecosm.com> | 2022-10-05 17:24:26 +0100 |
---|---|---|
committer | Philip Herron <philip.herron@embecosm.com> | 2022-10-06 14:07:16 +0100 |
commit | e033f1705dde104c44d69cec87cb728dba596c6f (patch) | |
tree | 073a1393a65f414b83a4874fed6503f799a174cf /gcc/rust/backend/rust-compile-expr.cc | |
parent | fc746fd620118f91bb8bfc139c7be3fb2356e820 (diff) | |
download | gcc-e033f1705dde104c44d69cec87cb728dba596c6f.zip gcc-e033f1705dde104c44d69cec87cb728dba596c6f.tar.gz gcc-e033f1705dde104c44d69cec87cb728dba596c6f.tar.bz2 |
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
Diffstat (limited to 'gcc/rust/backend/rust-compile-expr.cc')
-rw-r--r-- | gcc/rust/backend/rust-compile-expr.cc | 4 |
1 files changed, 2 insertions, 2 deletions
diff --git a/gcc/rust/backend/rust-compile-expr.cc b/gcc/rust/backend/rust-compile-expr.cc index 660ad09..9ff2be6 100644 --- a/gcc/rust/backend/rust-compile-expr.cc +++ b/gcc/rust/backend/rust-compile-expr.cc @@ -1982,7 +1982,7 @@ CompileExpr::resolve_method_address (TyTy::FnType *fntype, HirId ref, // trait-impl-item's definition auto root = receiver->get_root (); - std::vector<Resolver::PathProbeCandidate> candidates + auto candidates = Resolver::PathProbeType::Probe (root, segment, true /* probe_impls */, false /* probe_bounds */, true /* ignore_mandatory_trait_items */); @@ -2011,7 +2011,7 @@ CompileExpr::resolve_method_address (TyTy::FnType *fntype, HirId ref, // implementation and we should just return error_mark_node rust_assert (candidates.size () == 1); - auto &candidate = candidates.at (0); + auto &candidate = *candidates.begin (); rust_assert (candidate.is_impl_candidate ()); rust_assert (candidate.ty->get_kind () == TyTy::TypeKind::FNDEF); TyTy::FnType *candidate_call = static_cast<TyTy::FnType *> (candidate.ty); |