diff options
author | Philip Herron <herron.philip@googlemail.com> | 2023-02-27 19:16:00 +0000 |
---|---|---|
committer | Philip Herron <philip.herron@embecosm.com> | 2023-02-28 20:38:35 +0000 |
commit | 43a92787e3ff964ade498be3a6a1b6adc1f41087 (patch) | |
tree | 7ec6f193356791d07d4aa7937559cbd408409dcd /gcc/rust/hir/rust-hir-dump.cc | |
parent | a20426036a360d781dae2361ffd4c7dcfe4bb40a (diff) | |
download | gcc-43a92787e3ff964ade498be3a6a1b6adc1f41087.zip gcc-43a92787e3ff964ade498be3a6a1b6adc1f41087.tar.gz gcc-43a92787e3ff964ade498be3a6a1b6adc1f41087.tar.bz2 |
gccrs: Fix method resolution to use TryCoerce
Rust allows us to call generic pointer methods on pointers so in non
generic contexts the old code using the bad can_eq interface couldn't
handle this case. So taking advantage of our new unify_and interface to try
and infer when required we can start using our TryCoerce interface to reuse
existing code to assemble possible candidates more acurately using the
existing coercion rules.
Fixes #1901 #878
Signed-off-by: Philip Herron <herron.philip@googlemail.com>
gcc/rust/ChangeLog:
* typecheck/rust-coercion.cc (TypeCoercionRules::Coerce): Add new try_flag
(TypeCoercionRules::TypeCoercionRules): set new try flag
(TypeCoercionRules::do_coercion): default to a final unify_and in the else case
(TypeCoercionRules::coerce_unsafe_ptr): cannot coerce to a ptr from ref during autoderef
(TypeCoercionRules::coerce_borrowed_pointer): respect coerceable mutability
* typecheck/rust-coercion.h: update header
* typecheck/rust-hir-dot-operator.cc (MethodResolver::select): use new TryCoerce interface
(MethodResolver::append_adjustments): ensure we maintain adjustment mappings
* typecheck/rust-hir-dot-operator.h: add new method append_adjustments
* typecheck/rust-hir-type-check-expr.cc (TypeCheckExpr::visit): extra logging
gcc/testsuite/ChangeLog:
* rust/compile/issue-1901.rs: New test.
Diffstat (limited to 'gcc/rust/hir/rust-hir-dump.cc')
0 files changed, 0 insertions, 0 deletions