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/patterns.rs | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) (limited to 'crates/hir_ty/src/tests/patterns.rs') diff --git a/crates/hir_ty/src/tests/patterns.rs b/crates/hir_ty/src/tests/patterns.rs index f514b3efe..33305f208 100644 --- a/crates/hir_ty/src/tests/patterns.rs +++ b/crates/hir_ty/src/tests/patterns.rs @@ -243,8 +243,8 @@ fn infer_pattern_match_slice() { expect![[r#" 10..209 '{ ... } }': () 20..25 'slice': &[f64] - 36..42 '&[0.0]': &[f64; _] - 37..42 '[0.0]': [f64; _] + 36..42 '&[0.0]': &[f64; 1] + 37..42 '[0.0]': [f64; 1] 38..41 '0.0': f64 48..207 'match ... }': () 54..59 'slice': &[f64] @@ -346,7 +346,7 @@ fn infer_pattern_match_arr() { expect![[r#" 10..179 '{ ... } }': () 20..23 'arr': [f64; _] - 36..46 '[0.0, 1.0]': [f64; _] + 36..46 '[0.0, 1.0]': [f64; 2] 37..40 '0.0': f64 42..45 '1.0': f64 52..177 'match ... }': () -- cgit v1.2.3