diff options
author | Philip Herron <herron.philip@googlemail.com> | 2023-04-17 22:17:37 +0100 |
---|---|---|
committer | Arthur Cohen <arthur.cohen@embecosm.com> | 2024-01-16 18:34:15 +0100 |
commit | 68a0eb254f6615ae53f7c9beb383fbc883857bc4 (patch) | |
tree | c37edca984c6330ae57fab3e094a4fefb25d24f4 /gcc/rust/rust-session-manager.cc | |
parent | 04877f1096b9afe9d27552ffd0cc76388bbc6c03 (diff) | |
download | gcc-68a0eb254f6615ae53f7c9beb383fbc883857bc4.zip gcc-68a0eb254f6615ae53f7c9beb383fbc883857bc4.tar.gz gcc-68a0eb254f6615ae53f7c9beb383fbc883857bc4.tar.bz2 |
gccrs: Improve operator overload check for recursive overload
This is a case in #2019 where you have the default Add impl for i32 for
example which has:
impl Add for i32 {
fn add(self, other:i32) { self + other }
}
This function will do a check for operator overload which then is able to
find multiple candidates such as:
impl<'a> Add<i32> for &'a i32 {
type Output = <i32 as Add<i32>>::Output;
fn add(self, other: i32) -> <i32 as Add<i32>>::Output {
Add::add(*self, other)
}
}
This initial operator overload will resolve to this as it looks like a
valid candidate. This patch adds another level of checks to ensure the
candidate does not equal the current context DefId.
Addresses #2019
gcc/rust/ChangeLog:
* typecheck/rust-hir-type-check-expr.cc: update for op overload
Signed-off-by: Philip Herron <herron.philip@googlemail.com>
Diffstat (limited to 'gcc/rust/rust-session-manager.cc')
0 files changed, 0 insertions, 0 deletions