aboutsummaryrefslogtreecommitdiff
path: root/gcc
diff options
context:
space:
mode:
authorPhilip Herron <philip.herron@embecosm.com>2022-04-28 15:09:25 +0100
committerPhilip Herron <philip.herron@embecosm.com>2022-04-28 15:53:39 +0100
commitca7598514f5841cb08aef22a801d8a9f3f321b04 (patch)
tree2f7975f1b11a49e01b984c93b5988249ead5547a /gcc
parent83e13db1fa12d3ff8751a293595cbf01fd1ac236 (diff)
downloadgcc-ca7598514f5841cb08aef22a801d8a9f3f321b04.zip
gcc-ca7598514f5841cb08aef22a801d8a9f3f321b04.tar.gz
gcc-ca7598514f5841cb08aef22a801d8a9f3f321b04.tar.bz2
Add missing type inferencing rules for arrays and slices
Diffstat (limited to 'gcc')
-rw-r--r--gcc/rust/typecheck/rust-tyty-coercion.h24
1 files changed, 24 insertions, 0 deletions
diff --git a/gcc/rust/typecheck/rust-tyty-coercion.h b/gcc/rust/typecheck/rust-tyty-coercion.h
index e13c7f8..c862de5 100644
--- a/gcc/rust/typecheck/rust-tyty-coercion.h
+++ b/gcc/rust/typecheck/rust-tyty-coercion.h
@@ -856,6 +856,18 @@ public:
TyVar (base_resolved->get_ref ()));
}
+ void visit (InferType &type) override
+ {
+ if (type.get_infer_kind () != InferType::InferTypeKind::GENERAL)
+ {
+ BaseCoercionRules::visit (type);
+ return;
+ }
+
+ resolved = base->clone ();
+ resolved->set_ref (type.get_ref ());
+ }
+
private:
BaseType *get_base () override { return base; }
@@ -902,6 +914,18 @@ public:
TyVar (base_resolved->get_ref ()));
}
+ void visit (InferType &type) override
+ {
+ if (type.get_infer_kind () != InferType::InferTypeKind::GENERAL)
+ {
+ BaseCoercionRules::visit (type);
+ return;
+ }
+
+ resolved = base->clone ();
+ resolved->set_ref (type.get_ref ());
+ }
+
private:
BaseType *get_base () override { return base; }