aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--gcc/rust/typecheck/rust-hir-path-probe.h19
1 files changed, 9 insertions, 10 deletions
diff --git a/gcc/rust/typecheck/rust-hir-path-probe.h b/gcc/rust/typecheck/rust-hir-path-probe.h
index 8ceec00..589b0d6 100644
--- a/gcc/rust/typecheck/rust-hir-path-probe.h
+++ b/gcc/rust/typecheck/rust-hir-path-probe.h
@@ -275,16 +275,7 @@ protected:
}
TyTy::BaseType *trait_item_tyty = trait_item_ref->get_tyty ();
-
- // we cannot auto setup associated type mappings when our receiver is a
- // generic type bound
- const TyTy::BaseType *root = receiver->get_root ();
- bool receiver_is_type_param
- = root->get_kind () == TyTy::TypeKind::PARAM;
- bool receiver_is_dyn = root->get_kind () == TyTy::TypeKind::DYNAMIC;
- bool receiver_is_generic = receiver_is_type_param || receiver_is_dyn;
-
- if (impl != nullptr && !receiver_is_generic)
+ if (impl != nullptr && !is_reciever_generic ())
{
HirId impl_block_id = impl->get_mappings ().get_hirid ();
@@ -367,6 +358,14 @@ protected:
return union_set;
}
+ bool is_reciever_generic () const
+ {
+ const TyTy::BaseType *root = receiver->get_root ();
+ bool receiver_is_type_param = root->get_kind () == TyTy::TypeKind::PARAM;
+ bool receiver_is_dyn = root->get_kind () == TyTy::TypeKind::DYNAMIC;
+ return receiver_is_type_param || receiver_is_dyn;
+ }
+
const TyTy::BaseType *receiver;
const HIR::PathIdentSegment &search;
std::vector<PathProbeCandidate> candidates;