aboutsummaryrefslogtreecommitdiff
path: root/gcc/gimple-warn-recursion.cc
diff options
context:
space:
mode:
authorPhilip Herron <herron.philip@googlemail.com>2025-03-22 17:40:48 +0000
committerPhilip Herron <philip.herron@embecosm.com>2025-03-23 13:41:47 +0000
commit8c91ed5dc39a55dfcf8d074ff38132cbc4b9e28f (patch)
tree1319ab85c7be44af794d3f64bbf1c709456ad29a /gcc/gimple-warn-recursion.cc
parentb4895dae9b30413d77024a445af37b3df12d8dfa (diff)
downloadgcc-8c91ed5dc39a55dfcf8d074ff38132cbc4b9e28f.zip
gcc-8c91ed5dc39a55dfcf8d074ff38132cbc4b9e28f.tar.gz
gcc-8c91ed5dc39a55dfcf8d074ff38132cbc4b9e28f.tar.bz2
gccrs: support generic super traits recursively
In order to handle generic super traits on any trait bound we need to ensure we track the TypeBoundPredicate as part of the TraitReference instead of just the raw TraitReferences because these will have any applied generics enplace. Then for any TypeBoundPredicate it takes a copy of the super traits because this is the usage of a TraitBound and we can apply generics which then need to be recursively applied up the chain of super predicates. The main tweak is around TypeBoundPredicate::lookup_associated_item because we need to associate the predicate with the item we are looking up so the caller can respect the generics correctly as well. Fixes Rust-GCC#3502 gcc/rust/ChangeLog: * typecheck/rust-hir-path-probe.cc: update call * typecheck/rust-hir-trait-reference.cc (TraitReference::lookup_trait_item): track predicate (TraitReference::is_equal): likewise (TraitReference::is_object_safe): likewise (TraitReference::satisfies_bound): likewise * typecheck/rust-hir-trait-reference.h: likewise * typecheck/rust-hir-trait-resolve.cc (TraitResolver::resolve_trait): likewise * typecheck/rust-tyty-bounds.cc (TypeBoundPredicate::TypeBoundPredicate): track super traits (TypeBoundPredicate::operator=): likewise (TypeBoundPredicate::apply_generic_arguments): ensure we apply to super predicates (TypeBoundPredicateItem::operator=): take copy of parent predicate (TypeBoundPredicateItem::error): pass error instead of nullptr (TypeBoundPredicateItem::is_error): update to no longer check for nullptr (TypeBoundPredicateItem::get_parent): updated (TypeBoundPredicateItem::get_tyty_for_receiver): likewise (TypeBoundPredicate::get_associated_type_items): likewise * typecheck/rust-tyty-bounds.h (class TypeBoundPredicateItem): move * typecheck/rust-tyty-subst.cc: flag to handle placeholder Self on traits * typecheck/rust-tyty-subst.h (class TypeBoundPredicateItem): likewise * typecheck/rust-tyty.h (class TypeBoundPredicateItem): refactored gcc/testsuite/ChangeLog: * rust/execute/torture/issue-3502.rs: New test. Signed-off-by: Philip Herron <herron.philip@googlemail.com>
Diffstat (limited to 'gcc/gimple-warn-recursion.cc')
0 files changed, 0 insertions, 0 deletions