]> git.ipfire.org Git - thirdparty/gcc.git/commit
gccrs: Add check for super traits being implemented by Self
authorPhilip Herron <herron.philip@googlemail.com>
Wed, 26 Mar 2025 19:00:41 +0000 (19:00 +0000)
committerPhilip Herron <philip.herron@embecosm.com>
Thu, 27 Mar 2025 13:22:19 +0000 (13:22 +0000)
commit31ee9259a71742a455ead61c8b6142dcfab28b0f
tree84f713ba8d0b0b944ce0c7b373b8058910fa432a
parent23097f8132bcaf252020ed04758af71365758a8f
gccrs: Add check for super traits being implemented by Self

We need to recursively check the super traits of the predicate the Self
type is trying to implement. Otherwise its cannot implement it.

Fixes Rust-GCC#3553

gcc/rust/ChangeLog:

* typecheck/rust-hir-type-check-item.cc (TypeCheckItem::resolve_impl_block_substitutions):
Track the polarity
* typecheck/rust-tyty-bounds.cc (TypeBoundPredicate::validate_type_implements_this):
new validator
* typecheck/rust-tyty.h: new prototypes

gcc/testsuite/ChangeLog:

* rust/compile/issue-3553.rs: New test.

Signed-off-by: Philip Herron <herron.philip@googlemail.com>
gcc/rust/typecheck/rust-hir-type-check-item.cc
gcc/rust/typecheck/rust-tyty-bounds.cc
gcc/rust/typecheck/rust-tyty.h
gcc/testsuite/rust/compile/issue-3553.rs [new file with mode: 0644]