aboutsummaryrefslogtreecommitdiff
path: root/gcc/rust
diff options
context:
space:
mode:
authorPhilip Herron <herron.philip@googlemail.com>2025-02-03 15:45:12 +0000
committerPhilip Herron <philip.herron@embecosm.com>2025-02-03 19:46:20 +0000
commit12e9f5d02a0da7c98d8a5de9a2036b8930802e5e (patch)
tree94cd61daace2df659b870c9249114c2d434b619c /gcc/rust
parent218df42d73bb853c3ee080ffaafb12f6522fc31c (diff)
downloadgcc-12e9f5d02a0da7c98d8a5de9a2036b8930802e5e.zip
gcc-12e9f5d02a0da7c98d8a5de9a2036b8930802e5e.tar.gz
gcc-12e9f5d02a0da7c98d8a5de9a2036b8930802e5e.tar.bz2
gccrs: coercion sites allow for type inference as well.
Addresses Rust-GCC#3382 and Rust-GCC#3381 gcc/rust/ChangeLog: * typecheck/rust-type-util.cc (coercion_site): allow inference vars gcc/testsuite/ChangeLog: * rust/compile/reference1.rs: fix error message Signed-off-by: Philip Herron <herron.philip@googlemail.com>
Diffstat (limited to 'gcc/rust')
-rw-r--r--gcc/rust/typecheck/rust-type-util.cc6
1 files changed, 4 insertions, 2 deletions
diff --git a/gcc/rust/typecheck/rust-type-util.cc b/gcc/rust/typecheck/rust-type-util.cc
index 50892a3..b797188 100644
--- a/gcc/rust/typecheck/rust-type-util.cc
+++ b/gcc/rust/typecheck/rust-type-util.cc
@@ -217,8 +217,10 @@ coercion_site (HirId id, TyTy::TyWithLocation lhs, TyTy::TyWithLocation rhs,
rust_debug ("coerce_default_unify(a={%s}, b={%s})",
receiver->debug_str ().c_str (), expected->debug_str ().c_str ());
TyTy::BaseType *coerced
- = unify_site (id, lhs, TyTy::TyWithLocation (receiver, rhs.get_locus ()),
- locus);
+ = unify_site_and (id, lhs,
+ TyTy::TyWithLocation (receiver, rhs.get_locus ()), locus,
+ true /*emit_error*/, true /*commit*/, true /*infer*/,
+ true /*cleanup*/);
context->insert_autoderef_mappings (id, std::move (result.adjustments));
return coerced;
}