public inbox for gcc-cvs@sourceware.org
help / color / mirror / Atom feed
* [gcc/devel/rust/master] Add missing unify rules for inference variables
@ 2022-06-08 12:29 Thomas Schwinge
0 siblings, 0 replies; only message in thread
From: Thomas Schwinge @ 2022-06-08 12:29 UTC (permalink / raw)
To: gcc-cvs
https://gcc.gnu.org/g:7609dfc63e021117c194544f83b2edce34a81520
commit 7609dfc63e021117c194544f83b2edce34a81520
Author: Philip Herron <philip.herron@embecosm.com>
Date: Tue Apr 12 13:20:14 2022 +0100
Add missing unify rules for inference variables
Inference variables can unify with anything so this includes these
covariant types like references/slices etc. This patch is needed for more
complex type-checking in libcore and generics.
Diff:
---
gcc/rust/typecheck/rust-tyty-rules.h | 60 ++++++++++++++++++++++++++++++++++++
1 file changed, 60 insertions(+)
diff --git a/gcc/rust/typecheck/rust-tyty-rules.h b/gcc/rust/typecheck/rust-tyty-rules.h
index 7c50112db60..f95e7bf7cd1 100644
--- a/gcc/rust/typecheck/rust-tyty-rules.h
+++ b/gcc/rust/typecheck/rust-tyty-rules.h
@@ -867,6 +867,18 @@ public:
TyVar (base_resolved->get_ref ()));
}
+ void visit (InferType &type) override
+ {
+ if (type.get_infer_kind () != InferType::InferTypeKind::GENERAL)
+ {
+ BaseRules::visit (type);
+ return;
+ }
+
+ resolved = base->clone ();
+ resolved->set_ref (type.get_ref ());
+ }
+
private:
BaseType *get_base () override { return base; }
@@ -896,6 +908,18 @@ public:
TyVar (base_resolved->get_ref ()));
}
+ void visit (InferType &type) override
+ {
+ if (type.get_infer_kind () != InferType::InferTypeKind::GENERAL)
+ {
+ BaseRules::visit (type);
+ return;
+ }
+
+ resolved = base->clone ();
+ resolved->set_ref (type.get_ref ());
+ }
+
private:
BaseType *get_base () override { return base; }
@@ -1140,6 +1164,18 @@ public:
type.get_ident ().locus, fields);
}
+ void visit (InferType &type) override
+ {
+ if (type.get_infer_kind () != InferType::InferTypeKind::GENERAL)
+ {
+ BaseRules::visit (type);
+ return;
+ }
+
+ resolved = base->clone ();
+ resolved->set_ref (type.get_ref ());
+ }
+
private:
BaseType *get_base () override { return base; }
@@ -1263,6 +1299,18 @@ public:
base->mutability ());
}
+ void visit (InferType &type) override
+ {
+ if (type.get_infer_kind () != InferType::InferTypeKind::GENERAL)
+ {
+ BaseRules::visit (type);
+ return;
+ }
+
+ resolved = base->clone ();
+ resolved->set_ref (type.get_ref ());
+ }
+
private:
BaseType *get_base () override { return base; }
@@ -1303,6 +1351,18 @@ public:
base->mutability ());
}
+ void visit (InferType &type) override
+ {
+ if (type.get_infer_kind () != InferType::InferTypeKind::GENERAL)
+ {
+ BaseRules::visit (type);
+ return;
+ }
+
+ resolved = base->clone ();
+ resolved->set_ref (type.get_ref ());
+ }
+
private:
BaseType *get_base () override { return base; }
^ permalink raw reply [flat|nested] only message in thread
only message in thread, other threads:[~2022-06-08 12:29 UTC | newest]
Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2022-06-08 12:29 [gcc/devel/rust/master] Add missing unify rules for inference variables Thomas Schwinge
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).