From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: by sourceware.org (Postfix, from userid 1643) id 98E923858024; Fri, 14 Oct 2022 12:46:08 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org 98E923858024 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gcc.gnu.org; s=default; t=1665751568; bh=4Sls86KG/SqvWsL6gSDI+S3MozZQAgCk4gn010HHSEU=; h=From:To:Subject:Date:From; b=Fin55FmJHfZRKijTwi+LBMwLRPknQHMsmzCr+y07CUi4B64523EIlFn08OL1Ew7C+ Ju1XxLJFmSnKZDL46M08Hv8+bUKacAz42NqBQMcIgwLloUE7XGCm1lWHK9sNMpd3j4 993v58tuC01+IkNTEg8LXPXe81wms1rSzV34vrjo= Content-Type: text/plain; charset="us-ascii" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit From: Thomas Schwinge To: gcc-cvs@gcc.gnu.org Subject: [gcc/devel/rust/master] Merge #1587 X-Act-Checkin: gcc X-Git-Author: bors[bot] <26634292+bors[bot]@users.noreply.github.com> X-Git-Refname: refs/heads/devel/rust/master X-Git-Oldrev: 84ca2f9123a7d5206d70d5b3bdc18d98c0cee2e0 X-Git-Newrev: c85492954ded963d937de1fa8731be0718d117eb Message-Id: <20221014124608.98E923858024@sourceware.org> Date: Fri, 14 Oct 2022 12:46:08 +0000 (GMT) List-Id: https://gcc.gnu.org/g:c85492954ded963d937de1fa8731be0718d117eb commit c85492954ded963d937de1fa8731be0718d117eb Merge: 84ca2f9123a 9bac2dbfe99 Author: bors[bot] <26634292+bors[bot]@users.noreply.github.com> Date: Fri Oct 14 09:31:25 2022 +0000 Merge #1587 1587: Method resolution must support multiple candidates r=philberty a=philberty This patch fixes bad method resolution in our operator_overload_9 case. When we have a &mut reference to something and we deref we must resolve to the mutable reference impl block. The interface we are using to resolve methods is the can_eq interface which allows for permissive mutability which means allowing for mutable reference being unified with an immutable one. This meant we actual match against both the immutable and mutable version leading to multiple candidate error. Fixes #1588 Co-authored-by: Philip Herron Diff: gcc/rust/typecheck/rust-autoderef.cc | 12 +++- gcc/rust/typecheck/rust-hir-dot-operator.cc | 80 ++++++++++++++++++---- gcc/rust/typecheck/rust-hir-dot-operator.h | 16 +++-- .../typecheck/rust-hir-inherent-impl-overlap.h | 5 +- gcc/rust/typecheck/rust-hir-type-check-expr.cc | 35 ++++++++-- gcc/rust/typecheck/rust-tyty-cmp.h | 14 +++- gcc/rust/typecheck/rust-tyty.cc | 13 ++++ gcc/rust/typecheck/rust-tyty.h | 5 ++ gcc/testsuite/rust/compile/generics7.rs | 6 +- .../rust/execute/torture/operator_overload_9.rs | 2 +- 10 files changed, 157 insertions(+), 31 deletions(-)