diff options
author | Philip Herron <herron.philip@googlemail.com> | 2023-06-25 21:21:36 +0100 |
---|---|---|
committer | Philip Herron <philip.herron@embecosm.com> | 2023-06-25 21:07:02 +0000 |
commit | 337ed0fd1ba488754335b824263cff297e26e3bd (patch) | |
tree | 192bf2909d4be2f4ff8edb68a095c59ec297dc02 /gcc/rust/resolve | |
parent | 04eb580efaad6d74a6d93b47fc551f93cf40577d (diff) | |
download | gcc-337ed0fd1ba488754335b824263cff297e26e3bd.zip gcc-337ed0fd1ba488754335b824263cff297e26e3bd.tar.gz gcc-337ed0fd1ba488754335b824263cff297e26e3bd.tar.bz2 |
gccrs: Add method selection to operator overloading
When we do operator overloading we can get multiple candidates and we need
to use the optional arguments to filter the candidates event further. In
the bug we had:
<integer> + <usize>
Without the Add impl blocks for the primitive interger types we unify
against the rhs to figure out that the lhs should be a usize but when we
are using the impl blocks we need to use the rhs to ensure that its
possible to coerce the rhs to the expected fntype parameter to filter the
candidates.
Fixes #2304
gcc/rust/ChangeLog:
* typecheck/rust-autoderef.cc: use new selection filter
* typecheck/rust-hir-dot-operator.cc (MethodResolver::Select): new slection Filter
* typecheck/rust-hir-dot-operator.h: New select prototype
* typecheck/rust-hir-type-check-expr.cc: call select
* typecheck/rust-type-util.cc (try_coercion): new helper
* typecheck/rust-type-util.h (try_coercion): helper prototype
gcc/testsuite/ChangeLog:
* rust/compile/issue-2304.rs: New test.
Signed-off-by: Philip Herron <herron.philip@googlemail.com>
Diffstat (limited to 'gcc/rust/resolve')
0 files changed, 0 insertions, 0 deletions