]> git.ipfire.org Git - thirdparty/gcc.git/commit
gccrs: Extract helper lookup_associated_impl_block
authorPhilip Herron <herron.philip@googlemail.com>
Thu, 20 Apr 2023 15:56:46 +0000 (16:56 +0100)
committerArthur Cohen <arthur.cohen@embecosm.com>
Tue, 16 Jan 2024 17:34:15 +0000 (18:34 +0100)
commit0a0b51c5dc0453df4876cbd9c4e528d1faaf37ed
tree568b9344c3721869fd55793ac8d6f31a2219cb86
parent46eb2b751f1cbcab35972e57abcecc31b13d0889
gccrs: Extract helper lookup_associated_impl_block

This will look for a specified predicate that is associated with it so we
might have the predicate Foo<u16, i32> which would refer to:

  impl Foo<i32> for u16 {}

This is a general helper which can be used in several places.

gcc/rust/ChangeLog:

* typecheck/rust-hir-trait-reference.cc (AssociatedImplTrait::AssociatedImplTrait):
bind the predicate
(AssociatedImplTrait::get_trait): remove
(AssociatedImplTrait::get_predicate): new getter
* typecheck/rust-hir-trait-reference.h: bind predicate
* typecheck/rust-hir-type-check-item.cc: update ctor
* typecheck/rust-type-util.cc (lookup_associated_impl_block): new function
* typecheck/rust-type-util.h (class BaseType): remove unused forward decl
(lookup_associated_impl_block): new helper
* typecheck/rust-tyty-bounds.cc (TypeBoundPredicate::is_equal): new
* typecheck/rust-tyty-subst.cc (SubstitutionRef::lookup_associated_impl): use new helper
(SubstitutionRef::monomorphize): update usage/error handling
* typecheck/rust-tyty-subst.h: remove old prototype
* typecheck/rust-tyty.h: add is_equal decl

Signed-off-by: Philip Herron <herron.philip@googlemail.com>
gcc/rust/typecheck/rust-hir-trait-reference.cc
gcc/rust/typecheck/rust-hir-trait-reference.h
gcc/rust/typecheck/rust-hir-type-check-item.cc
gcc/rust/typecheck/rust-type-util.cc
gcc/rust/typecheck/rust-type-util.h
gcc/rust/typecheck/rust-tyty-bounds.cc
gcc/rust/typecheck/rust-tyty-subst.cc
gcc/rust/typecheck/rust-tyty-subst.h
gcc/rust/typecheck/rust-tyty.h