From dc63fea427280ff278bf89a8b9c78df606009910 Mon Sep 17 00:00:00 2001 From: Jade Date: Tue, 11 May 2021 05:06:33 -0700 Subject: Add basic support for array lengths in types This recognizes `let a = [1u8, 2, 3]` as having type `[u8; 3]` instead of the previous `[u8; _]`. Byte strings and `[0u8; 2]` kinds of range array declarations are unsupported as before. I don't know why a bunch of our rustc tests had single quotes inside strings un-escaped by `UPDATE_EXPECT=1 cargo t`, but I don't think it's bad? Maybe something in a nightly? --- crates/hir_ty/src/tests/traits.rs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'crates/hir_ty/src/tests/traits.rs') diff --git a/crates/hir_ty/src/tests/traits.rs b/crates/hir_ty/src/tests/traits.rs index ffc7c8ef4..47a1455fd 100644 --- a/crates/hir_ty/src/tests/traits.rs +++ b/crates/hir_ty/src/tests/traits.rs @@ -531,7 +531,7 @@ fn indexing_arrays() { expect![[r#" 10..26 '{ &mut...[2]; }': () 12..23 '&mut [9][2]': &mut {unknown} - 17..20 '[9]': [i32; _] + 17..20 '[9]': [i32; 1] 17..23 '[9][2]': {unknown} 18..19 '9': i32 21..22 '2': i32 -- cgit v1.2.3