From 0c0f33bc439a98f9923a48be592bb9a2be540ac3 Mon Sep 17 00:00:00 2001 From: Philip Herron Date: Fri, 11 Oct 2024 17:53:50 +0100 Subject: gccrs: Fix bad recursive operator overload call When we are typechecking the impl block for DerefMut for &mut T the implementation follows the usual operator overload check but this ended up just resolving directly to the Trait definition which ends up being recursive which we usually handle. The issue we had is that a dereference call can be for either the DEREF or DEREF_MUT lang item here it was looking for a recurisve call to the DEREF lang item but we were in the DEREF_MUT lang item so this case was not accounted for. Fixes #3032 gcc/rust/ChangeLog: * typecheck/rust-hir-trait-reference.h: new get locus helper * typecheck/rust-hir-trait-resolve.cc (AssociatedImplTrait::get_locus): implemention * typecheck/rust-hir-type-check-expr.cc (TypeCheckExpr::resolve_operator_overload): fix overload gcc/testsuite/ChangeLog: * rust/compile/nr2/exclude: nr2 cant handle this * rust/compile/issue-3032-1.rs: New test. * rust/compile/issue-3032-2.rs: New test. Signed-off-by: Philip Herron --- gcc/testsuite/rust/compile/nr2/exclude | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) (limited to 'gcc/testsuite/rust/compile/nr2/exclude') diff --git a/gcc/testsuite/rust/compile/nr2/exclude b/gcc/testsuite/rust/compile/nr2/exclude index ecef6d2..383950c 100644 --- a/gcc/testsuite/rust/compile/nr2/exclude +++ b/gcc/testsuite/rust/compile/nr2/exclude @@ -234,4 +234,6 @@ issue-3139-3.rs issue-3036.rs issue-2951.rs issue-2203.rs -issue-2499.rs \ No newline at end of file +issue-2499.rs +issue-3032-1.rs +issue-3032-2.rs \ No newline at end of file -- cgit v1.1