about summary refs log tree commit diff
path: root/src/test
diff options
context:
space:
mode:
authorAaron Hill <aa1ronham@gmail.com>2020-11-25 16:03:10 -0500
committerAaron Hill <aa1ronham@gmail.com>2020-11-25 18:41:10 -0500
commit0b64110b10c9ef5f971aab4b05975dee922a7bc3 (patch)
tree6a0333a6e221f04eff0a4b73009329c7e35de2ce /src/test
parentdb79d2f63780613e700cb58b4339c48287555ae0 (diff)
downloadrust-0b64110b10c9ef5f971aab4b05975dee922a7bc3.tar.gz
rust-0b64110b10c9ef5f971aab4b05975dee922a7bc3.zip
Resolve inference variables before trying to remove overloaded indexing
Fixes #79152

This code was already set up to handle indexing an array. However, it
appears that we never end up with an inference variable for the slice
case, so the missing call to `resolve_vars_if_possible` had no effect
until now.
Diffstat (limited to 'src/test')
-rw-r--r--src/test/ui/consts/issue-79152-const-array-index.rs11
1 files changed, 11 insertions, 0 deletions
diff --git a/src/test/ui/consts/issue-79152-const-array-index.rs b/src/test/ui/consts/issue-79152-const-array-index.rs
new file mode 100644
index 00000000000..95518e1bbdb
--- /dev/null
+++ b/src/test/ui/consts/issue-79152-const-array-index.rs
@@ -0,0 +1,11 @@
+// check-pass
+// Regression test for issue #79152
+//
+// Tests that we can index an array in a const function
+
+const fn foo() {
+    let mut array = [[0; 1]; 1];
+    array[0][0] = 1;
+}
+
+fn main() {}