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: bug-fix implicit inference checks Date: Tue, 28 Feb 2023 22:37:35 +0000 (GMT) [thread overview] Message-ID: <20230228223735.0C56E3858404@sourceware.org> (raw) https://gcc.gnu.org/g:a20426036a360d781dae2361ffd4c7dcfe4bb40a commit a20426036a360d781dae2361ffd4c7dcfe4bb40a Author: Philip Herron <herron.philip@googlemail.com> Date: Mon Feb 27 17:39:09 2023 +0000 gccrs: bug-fix implicit inference checks When generating implicit inference variables we can miss cases where the other side might be another inference variable too but it runs the risk of generating unending inference cycles needing more info but if they other side is a non general inference variables like <integer> or <float> this is safe to do so and allows us to infer mroe cases. Signed-off-by: Philip Herron <herron.philip@googlemail.com> gcc/rust/ChangeLog: * typecheck/rust-unify.cc (UnifyRules::go): fix inference check Diff: --- gcc/rust/typecheck/rust-unify.cc | 14 ++++++++++++-- 1 file changed, 12 insertions(+), 2 deletions(-) diff --git a/gcc/rust/typecheck/rust-unify.cc b/gcc/rust/typecheck/rust-unify.cc index e76b362aa0c..fb7b5d4bd6f 100644 --- a/gcc/rust/typecheck/rust-unify.cc +++ b/gcc/rust/typecheck/rust-unify.cc @@ -153,12 +153,22 @@ UnifyRules::go () { bool rgot_param = rtype->get_kind () == TyTy::TypeKind::PARAM; bool lhs_is_infer_var = ltype->get_kind () == TyTy::TypeKind::INFER; - bool expected_is_concrete = ltype->is_concrete () && !lhs_is_infer_var; + bool lhs_is_general_infer_var + = lhs_is_infer_var + && static_cast<TyTy::InferType *> (ltype)->get_infer_kind () + == TyTy::InferType::GENERAL; + bool expected_is_concrete + = ltype->is_concrete () && !lhs_is_general_infer_var; bool rneeds_infer = expected_is_concrete && rgot_param; bool lgot_param = ltype->get_kind () == TyTy::TypeKind::PARAM; bool rhs_is_infer_var = rtype->get_kind () == TyTy::TypeKind::INFER; - bool receiver_is_concrete = rtype->is_concrete () && !rhs_is_infer_var; + bool rhs_is_general_infer_var + = rhs_is_infer_var + && static_cast<TyTy::InferType *> (rtype)->get_infer_kind () + == TyTy::InferType::GENERAL; + bool receiver_is_concrete + = rtype->is_concrete () && !rhs_is_general_infer_var; bool lneeds_infer = receiver_is_concrete && lgot_param; if (rneeds_infer)
reply other threads:[~2023-02-28 22:37 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=20230228223735.0C56E3858404@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).