aboutsummaryrefslogtreecommitdiff
path: root/gcc
diff options
context:
space:
mode:
authorFaisal Abbas <90.abbasfaisal@gmail.com>2022-09-04 16:07:43 +0100
committerFaisal Abbas <90.abbasfaisal@gmail.com>2022-09-04 16:45:41 +0100
commita4f07c8391287c4cc95900f86e16b0f667396f36 (patch)
tree8a04cc1ddeccb79c9a2db062698f9cf4662b8f41 /gcc
parent4f0a2729d78d77f14140531ca809d1c45311f0c9 (diff)
downloadgcc-a4f07c8391287c4cc95900f86e16b0f667396f36.zip
gcc-a4f07c8391287c4cc95900f86e16b0f667396f36.tar.gz
gcc-a4f07c8391287c4cc95900f86e16b0f667396f36.tar.bz2
bugfix: initialize slice from array in const context
Diffstat (limited to 'gcc')
-rw-r--r--gcc/rust/typecheck/rust-hir-type-check-stmt.cc2
-rw-r--r--gcc/testsuite/rust/compile/const6.rs4
2 files changed, 5 insertions, 1 deletions
diff --git a/gcc/rust/typecheck/rust-hir-type-check-stmt.cc b/gcc/rust/typecheck/rust-hir-type-check-stmt.cc
index 48db1fd..ce8d97b 100644
--- a/gcc/rust/typecheck/rust-hir-type-check-stmt.cc
+++ b/gcc/rust/typecheck/rust-hir-type-check-stmt.cc
@@ -68,7 +68,7 @@ TypeCheckStmt::visit (HIR::ConstantItem &constant)
TyTy::BaseType *type = TypeCheckType::Resolve (constant.get_type ());
TyTy::BaseType *expr_type = TypeCheckExpr::Resolve (constant.get_expr ());
- infered = unify_site (
+ infered = coercion_site (
constant.get_mappings ().get_hirid (),
TyTy::TyWithLocation (type, constant.get_type ()->get_locus ()),
TyTy::TyWithLocation (expr_type, constant.get_expr ()->get_locus ()),
diff --git a/gcc/testsuite/rust/compile/const6.rs b/gcc/testsuite/rust/compile/const6.rs
new file mode 100644
index 0000000..8f0dc32
--- /dev/null
+++ b/gcc/testsuite/rust/compile/const6.rs
@@ -0,0 +1,4 @@
+fn main() {
+ const array:[i32; 1] = [1];
+ const slice:&[i32] = &array;
+}