-
Notifications
You must be signed in to change notification settings - Fork 179
Multiple candidate method resolution error #2304
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Comments
Method selection needs to take into account the other arguments to help resolve this case |
This is the output of pub fn test() ({
let x: usize = (123 as usize);
let mut i = (0 as usize);
let bug = ((i as usize) + (x as usize) as usize);
} as ()) |
Yeah i think the method selection is meant to see i + x and turn i into a usize. |
What are you using to debug? |
@powerboat9 i use -frust-debug but i also added in a few calls to TyTy::BaseType::debug to emit each of the candidates. |
The fix here should also fix #1586 |
philberty
added a commit
that referenced
this issue
Jun 25, 2023
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 <[email protected]>
github-merge-queue bot
pushed a commit
that referenced
this issue
Jun 25, 2023
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 <[email protected]>
jdupak
pushed a commit
to jdupak/gccrs
that referenced
this issue
Aug 19, 2023
Addresses Rust-GCC#2304 gcc/rust/ChangeLog: * typecheck/rust-unify.cc (UnifyRules::emit_abi_mismatch): new error method (UnifyRules::expect_fndef): add ABI check * typecheck/rust-unify.h: prototype for new error method Signed-off-by: Philip Herron <[email protected]>
CohenArthur
pushed a commit
to CohenArthur/gccrs
that referenced
this issue
Nov 15, 2023
Addresses Rust-GCC#2304 gcc/rust/ChangeLog: * typecheck/rust-unify.cc (UnifyRules::emit_abi_mismatch): new error method (UnifyRules::expect_fndef): add ABI check * typecheck/rust-unify.h: prototype for new error method Signed-off-by: Philip Herron <[email protected]>
CohenArthur
pushed a commit
to CohenArthur/gccrs
that referenced
this issue
Nov 15, 2023
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 Rust-GCC#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 <[email protected]>
CohenArthur
pushed a commit
to CohenArthur/gccrs
that referenced
this issue
Nov 21, 2023
Addresses Rust-GCC#2304 gcc/rust/ChangeLog: * typecheck/rust-unify.cc (UnifyRules::emit_abi_mismatch): new error method (UnifyRules::expect_fndef): add ABI check * typecheck/rust-unify.h: prototype for new error method Signed-off-by: Philip Herron <[email protected]>
CohenArthur
pushed a commit
to CohenArthur/gccrs
that referenced
this issue
Nov 21, 2023
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 Rust-GCC#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 <[email protected]>
CohenArthur
pushed a commit
to CohenArthur/gccrs
that referenced
this issue
Nov 21, 2023
Addresses Rust-GCC#2304 gcc/rust/ChangeLog: * typecheck/rust-unify.cc (UnifyRules::emit_abi_mismatch): new error method (UnifyRules::expect_fndef): add ABI check * typecheck/rust-unify.h: prototype for new error method Signed-off-by: Philip Herron <[email protected]>
CohenArthur
pushed a commit
to CohenArthur/gccrs
that referenced
this issue
Nov 21, 2023
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 Rust-GCC#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 <[email protected]>
CohenArthur
pushed a commit
to CohenArthur/gccrs
that referenced
this issue
Jan 5, 2024
Addresses Rust-GCC#2304 gcc/rust/ChangeLog: * typecheck/rust-unify.cc (UnifyRules::emit_abi_mismatch): new error method (UnifyRules::expect_fndef): add ABI check * typecheck/rust-unify.h: prototype for new error method Signed-off-by: Philip Herron <[email protected]>
CohenArthur
pushed a commit
to CohenArthur/gccrs
that referenced
this issue
Jan 5, 2024
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 Rust-GCC#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 <[email protected]>
CohenArthur
pushed a commit
to CohenArthur/gccrs
that referenced
this issue
Jan 8, 2024
Addresses Rust-GCC#2304 gcc/rust/ChangeLog: * typecheck/rust-unify.cc (UnifyRules::emit_abi_mismatch): new error method (UnifyRules::expect_fndef): add ABI check * typecheck/rust-unify.h: prototype for new error method Signed-off-by: Philip Herron <[email protected]>
CohenArthur
pushed a commit
to CohenArthur/gccrs
that referenced
this issue
Jan 8, 2024
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 Rust-GCC#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 <[email protected]>
CohenArthur
pushed a commit
to CohenArthur/gccrs
that referenced
this issue
Jan 9, 2024
Addresses Rust-GCC#2304 gcc/rust/ChangeLog: * typecheck/rust-unify.cc (UnifyRules::emit_abi_mismatch): new error method (UnifyRules::expect_fndef): add ABI check * typecheck/rust-unify.h: prototype for new error method Signed-off-by: Philip Herron <[email protected]>
CohenArthur
pushed a commit
to CohenArthur/gccrs
that referenced
this issue
Jan 9, 2024
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 Rust-GCC#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 <[email protected]>
CohenArthur
pushed a commit
to CohenArthur/gccrs
that referenced
this issue
Jan 9, 2024
Addresses Rust-GCC#2304 gcc/rust/ChangeLog: * typecheck/rust-unify.cc (UnifyRules::emit_abi_mismatch): new error method (UnifyRules::expect_fndef): add ABI check * typecheck/rust-unify.h: prototype for new error method Signed-off-by: Philip Herron <[email protected]>
CohenArthur
pushed a commit
to CohenArthur/gccrs
that referenced
this issue
Jan 9, 2024
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 Rust-GCC#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 <[email protected]>
CohenArthur
pushed a commit
to CohenArthur/gccrs
that referenced
this issue
Jan 9, 2024
Addresses Rust-GCC#2304 gcc/rust/ChangeLog: * typecheck/rust-unify.cc (UnifyRules::emit_abi_mismatch): new error method (UnifyRules::expect_fndef): add ABI check * typecheck/rust-unify.h: prototype for new error method Signed-off-by: Philip Herron <[email protected]>
CohenArthur
pushed a commit
to CohenArthur/gccrs
that referenced
this issue
Jan 9, 2024
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 Rust-GCC#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 <[email protected]>
CohenArthur
pushed a commit
to CohenArthur/gccrs
that referenced
this issue
Jan 9, 2024
Addresses Rust-GCC#2304 gcc/rust/ChangeLog: * typecheck/rust-unify.cc (UnifyRules::emit_abi_mismatch): new error method (UnifyRules::expect_fndef): add ABI check * typecheck/rust-unify.h: prototype for new error method Signed-off-by: Philip Herron <[email protected]>
CohenArthur
pushed a commit
to CohenArthur/gccrs
that referenced
this issue
Jan 9, 2024
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 Rust-GCC#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 <[email protected]>
CohenArthur
pushed a commit
to CohenArthur/gccrs
that referenced
this issue
Jan 9, 2024
Addresses Rust-GCC#2304 gcc/rust/ChangeLog: * typecheck/rust-unify.cc (UnifyRules::emit_abi_mismatch): new error method (UnifyRules::expect_fndef): add ABI check * typecheck/rust-unify.h: prototype for new error method Signed-off-by: Philip Herron <[email protected]>
CohenArthur
pushed a commit
to CohenArthur/gccrs
that referenced
this issue
Jan 9, 2024
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 Rust-GCC#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 <[email protected]>
CohenArthur
pushed a commit
to CohenArthur/gccrs
that referenced
this issue
Jan 9, 2024
Addresses Rust-GCC#2304 gcc/rust/ChangeLog: * typecheck/rust-unify.cc (UnifyRules::emit_abi_mismatch): new error method (UnifyRules::expect_fndef): add ABI check * typecheck/rust-unify.h: prototype for new error method Signed-off-by: Philip Herron <[email protected]>
CohenArthur
pushed a commit
to CohenArthur/gccrs
that referenced
this issue
Jan 9, 2024
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 Rust-GCC#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 <[email protected]>
CohenArthur
pushed a commit
to CohenArthur/gccrs
that referenced
this issue
Jan 11, 2024
Addresses Rust-GCC#2304 gcc/rust/ChangeLog: * typecheck/rust-unify.cc (UnifyRules::emit_abi_mismatch): new error method (UnifyRules::expect_fndef): add ABI check * typecheck/rust-unify.h: prototype for new error method Signed-off-by: Philip Herron <[email protected]>
CohenArthur
pushed a commit
to CohenArthur/gccrs
that referenced
this issue
Jan 11, 2024
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 Rust-GCC#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 <[email protected]>
CohenArthur
pushed a commit
to CohenArthur/gccrs
that referenced
this issue
Jan 12, 2024
Addresses Rust-GCC#2304 gcc/rust/ChangeLog: * typecheck/rust-unify.cc (UnifyRules::emit_abi_mismatch): new error method (UnifyRules::expect_fndef): add ABI check * typecheck/rust-unify.h: prototype for new error method Signed-off-by: Philip Herron <[email protected]>
CohenArthur
pushed a commit
to CohenArthur/gccrs
that referenced
this issue
Jan 12, 2024
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 Rust-GCC#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 <[email protected]>
CohenArthur
pushed a commit
to CohenArthur/gccrs
that referenced
this issue
Jan 16, 2024
Addresses Rust-GCC#2304 gcc/rust/ChangeLog: * typecheck/rust-unify.cc (UnifyRules::emit_abi_mismatch): new error method (UnifyRules::expect_fndef): add ABI check * typecheck/rust-unify.h: prototype for new error method Signed-off-by: Philip Herron <[email protected]>
CohenArthur
pushed a commit
to CohenArthur/gccrs
that referenced
this issue
Jan 16, 2024
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 Rust-GCC#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 <[email protected]>
CohenArthur
pushed a commit
to CohenArthur/gccrs
that referenced
this issue
Jan 16, 2024
Addresses Rust-GCC#2304 gcc/rust/ChangeLog: * typecheck/rust-unify.cc (UnifyRules::emit_abi_mismatch): new error method (UnifyRules::expect_fndef): add ABI check * typecheck/rust-unify.h: prototype for new error method Signed-off-by: Philip Herron <[email protected]>
CohenArthur
pushed a commit
to CohenArthur/gccrs
that referenced
this issue
Jan 16, 2024
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 Rust-GCC#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 <[email protected]>
CohenArthur
pushed a commit
to CohenArthur/gccrs
that referenced
this issue
Jan 17, 2024
Addresses Rust-GCC#2304 gcc/rust/ChangeLog: * typecheck/rust-unify.cc (UnifyRules::emit_abi_mismatch): new error method (UnifyRules::expect_fndef): add ABI check * typecheck/rust-unify.h: prototype for new error method Signed-off-by: Philip Herron <[email protected]>
CohenArthur
pushed a commit
to CohenArthur/gccrs
that referenced
this issue
Jan 17, 2024
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 Rust-GCC#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 <[email protected]>
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
I tried this code: https://godbolt.org/z/KdfGEbxK8
I expected to see this happen: compile without error
Instead, this happened:
Its not obvious from the error message but adding in some debugging shows there are multiple candidates:
Meta
The text was updated successfully, but these errors were encountered: