aboutsummaryrefslogtreecommitdiff
path: root/gcc/rust/backend/rust-compile-implitem.h
diff options
context:
space:
mode:
authorPhilip Herron <philip.herron@embecosm.com>2021-03-26 15:23:57 +0000
committerPhilip Herron <herron.philip@googlemail.com>2021-03-27 18:55:14 +0000
commite4ea09d6b8e501dc7bd7046da641b70e02814b09 (patch)
treea01041da77d9276a52d0dbcb08d6a5c3913b03fe /gcc/rust/backend/rust-compile-implitem.h
parent380c8295051c6b42adb4f703268c7465aed57c44 (diff)
downloadgcc-e4ea09d6b8e501dc7bd7046da641b70e02814b09.zip
gcc-e4ea09d6b8e501dc7bd7046da641b70e02814b09.tar.gz
gcc-e4ea09d6b8e501dc7bd7046da641b70e02814b09.tar.bz2
Add Generic Impl block support
This extends the support from #237 to extend this to MethodCallExpr, this now follows a similar path to normal CallExprs and ensures the used arguments in substitution are preserved during unification of types. Part of method resolution is fixed here by taking advantage if is_equal instead of unify calls which could result in bad errors which are just part of the probe process to lookup possible candidates for method resolution. Fixes #306
Diffstat (limited to 'gcc/rust/backend/rust-compile-implitem.h')
-rw-r--r--gcc/rust/backend/rust-compile-implitem.h15
1 files changed, 15 insertions, 0 deletions
diff --git a/gcc/rust/backend/rust-compile-implitem.h b/gcc/rust/backend/rust-compile-implitem.h
index 15aba9b..cee3a3b 100644
--- a/gcc/rust/backend/rust-compile-implitem.h
+++ b/gcc/rust/backend/rust-compile-implitem.h
@@ -272,6 +272,21 @@ public:
}
TyTy::FnType *fntype = static_cast<TyTy::FnType *> (fntype_tyty);
+ if (fntype->has_subsititions_defined ())
+ {
+ // we cant do anything for this only when it is used
+ if (concrete == nullptr)
+ return;
+ else
+ {
+ rust_assert (concrete->get_kind () == TyTy::TypeKind::FNDEF);
+ fntype = static_cast<TyTy::FnType *> (concrete);
+
+ // override the Hir Lookups for the substituions in this context
+ fntype->override_context ();
+ }
+ }
+
// convert to the actual function type
::Btype *compiled_fn_type = TyTyResolveCompile::compile (ctx, fntype);