public inbox for gcc-cvs@sourceware.org help / color / mirror / Atom feed
From: Thomas Schwinge <tschwinge@gcc.gnu.org> To: gcc-cvs@gcc.gnu.org Subject: [gcc/devel/rust/master] gccrs: Take advantage of our new unify_and to inject inference Date: Sun, 5 Mar 2023 11:42:25 +0000 (GMT) [thread overview] Message-ID: <20230305114225.48AC7385840A@sourceware.org> (raw) https://gcc.gnu.org/g:6540653bc29778a5473746bc7463c75204e07c23 commit 6540653bc29778a5473746bc7463c75204e07c23 Author: Philip Herron <herron.philip@googlemail.com> Date: Fri Mar 3 18:42:21 2023 +0000 gccrs: Take advantage of our new unify_and to inject inference Wen computing higher ranked trait bounds where there are multiple type params and ones which are not bound entirely on the impl-type we need to inject inference variables as required to compute the types. The inference variables we inject are missing the callbacks that we can compute the bounds properly so this is the first part of the fix. Addresses #1893 Signed-off-by: Philip Herron <herron.philip@googlemail.com> gcc/rust/ChangeLog: * typecheck/rust-hir-trait-resolve.cc: use unify_and infer Diff: --- gcc/rust/typecheck/rust-hir-trait-resolve.cc | 16 ++++++++++------ 1 file changed, 10 insertions(+), 6 deletions(-) diff --git a/gcc/rust/typecheck/rust-hir-trait-resolve.cc b/gcc/rust/typecheck/rust-hir-trait-resolve.cc index 5a4d9660219..632a60a5366 100644 --- a/gcc/rust/typecheck/rust-hir-trait-resolve.cc +++ b/gcc/rust/typecheck/rust-hir-trait-resolve.cc @@ -497,10 +497,12 @@ AssociatedImplTrait::setup_associated_types ( // the type correctly as our receiver may be generic and we are inferring its // generic arguments and this Self might be the concrete version or vice // versa. - auto result = unify_site (get_impl_block ()->get_mappings ().get_hirid (), - TyTy::TyWithLocation (receiver), - TyTy::TyWithLocation (impl_self_infer), - impl_predicate.get_locus ()); + auto result = unify_site_and (get_impl_block ()->get_mappings ().get_hirid (), + TyTy::TyWithLocation (receiver), + TyTy::TyWithLocation (impl_self_infer), + impl_predicate.get_locus (), + true /*emit-errors*/, true /*commit-if-ok*/, + true /*infer*/, true /*cleanup-on-fail*/); rust_assert (result->get_kind () != TyTy::TypeKind::ERROR); TyTy::BaseType *self_result = result; @@ -525,8 +527,10 @@ AssociatedImplTrait::setup_associated_types ( TyTy::BaseType *b = hrtb_bound_arguments.at (i); result - = unify_site (a->get_ref (), TyTy::TyWithLocation (a), - TyTy::TyWithLocation (b), impl_predicate.get_locus ()); + = unify_site_and (a->get_ref (), TyTy::TyWithLocation (a), + TyTy::TyWithLocation (b), impl_predicate.get_locus (), + true /*emit-errors*/, true /*commit-if-ok*/, + true /*infer*/, true /*cleanup-on-fail*/); rust_assert (result->get_kind () != TyTy::TypeKind::ERROR); }
reply other threads:[~2023-03-05 11:42 UTC|newest] Thread overview: [no followups] expand[flat|nested] mbox.gz Atom feed
Reply instructions: You may reply publicly to this message via plain-text email using any one of the following methods: * Save the following mbox file, import it into your mail client, and reply-to-all from there: mbox Avoid top-posting and favor interleaved quoting: https://en.wikipedia.org/wiki/Posting_style#Interleaved_style * Reply using the --to, --cc, and --in-reply-to switches of git-send-email(1): git send-email \ --in-reply-to=20230305114225.48AC7385840A@sourceware.org \ --to=tschwinge@gcc.gnu.org \ --cc=gcc-cvs@gcc.gnu.org \ /path/to/YOUR_REPLY https://kernel.org/pub/software/scm/git/docs/git-send-email.html * If your mail client supports setting the In-Reply-To header via mailto: links, try the mailto: linkBe sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions for how to clone and mirror all data and code used for this inbox; as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).