[COMMITTED 20/83] gccrs: add more bound filtering

arthur.cohen@opensrcsec.com arthur.cohen@opensrcsec.com
Wed Sep 16 12:29:39 GMT 2026


From: Philip Herron <herron.philip@googlemail.com>

gcc/rust/ChangeLog:

	* typecheck/rust-type-util.cc (lookup_associated_impl_block): add filter
	(normalize_projection): likewise

Signed-off-by: Philip Herron <herron.philip@googlemail.com>
---
 gcc/rust/typecheck/rust-type-util.cc | 6 ++++--
 1 file changed, 4 insertions(+), 2 deletions(-)

diff --git a/gcc/rust/typecheck/rust-type-util.cc b/gcc/rust/typecheck/rust-type-util.cc
index 4a6f444beed..97ff25d4368 100644
--- a/gcc/rust/typecheck/rust-type-util.cc
+++ b/gcc/rust/typecheck/rust-type-util.cc
@@ -382,7 +382,8 @@ lookup_associated_impl_block (const TyTy::TypeBoundPredicate &bound,
 
   // setup any associated type mappings for the specified bonds and this
   // type
-  auto candidates = TypeBoundsProbe::Probe (binding);
+  auto candidates
+    = TypeBoundsProbe::Probe (binding, bound.get ()->get_hir_trait_ref ());
   std::vector<AssociatedImplTrait *> associated_impl_traits;
   for (auto &probed_bound : candidates)
     {
@@ -669,7 +670,8 @@ normalize_projection (TyTy::ProjectionType *proj, location_t locus,
 	  && self->get_kind () != TyTy::TypeKind::INFER
 	  && self->get_kind () != TyTy::TypeKind::PROJECTION)
 	{
-	  auto candidates = TypeBoundsProbe::Probe (self);
+	  auto candidates = TypeBoundsProbe::Probe (
+	    self, proj->get_trait_ref ()->get_hir_trait_ref ());
 	  for (auto &probed : candidates)
 	    {
 	      HIR::ImplBlock *impl_block = probed.second;
-- 
2.50.1



More information about the Gcc-rust mailing list