aboutsummaryrefslogtreecommitdiff
path: root/crates/hir/src
diff options
context:
space:
mode:
authorbors[bot] <26634292+bors[bot]@users.noreply.github.com>2021-05-16 02:53:12 +0100
committerGitHub <[email protected]>2021-05-16 02:53:12 +0100
commita57bd59f351600c408ef9d2a4df3f2c10e817d0d (patch)
tree73af1b67227643ef4e8caa77ba50f2ad738ddd4e /crates/hir/src
parent92abc56bc928fb2a11b8f5b2a37e3c9ee31102d7 (diff)
parentde0ed9860d86c3b905a967b1a7b5243499d32d67 (diff)
Merge #8813
8813: Get some more array lengths! r=lf- a=lf- This is built on #8799 and thus contains its changes. I'll rebase it onto master when that one gets merged. It adds support for r-a understanding the length of: * `let a: [u8; 2] = ...` * `let a = b"aaa"` * `let a = [0u8; 4]` I have added support for getting the values of byte strings, which was not previously there. I am least confident in the correctness of this part and it probably needs some more tests, as we currently have only one test that exercised that part (!). Fixes #2922. Co-authored-by: Jade <[email protected]>
Diffstat (limited to 'crates/hir/src')
-rw-r--r--crates/hir/src/lib.rs5
1 files changed, 4 insertions, 1 deletions
diff --git a/crates/hir/src/lib.rs b/crates/hir/src/lib.rs
index 6233bca83..d443b124c 100644
--- a/crates/hir/src/lib.rs
+++ b/crates/hir/src/lib.rs
@@ -52,7 +52,9 @@ use hir_def::{
52}; 52};
53use hir_expand::{diagnostics::DiagnosticSink, name::name, MacroDefKind}; 53use hir_expand::{diagnostics::DiagnosticSink, name::name, MacroDefKind};
54use hir_ty::{ 54use hir_ty::{
55 autoderef, could_unify, 55 autoderef,
56 consteval::ConstExt,
57 could_unify,
56 method_resolution::{self, def_crates, TyFingerprint}, 58 method_resolution::{self, def_crates, TyFingerprint},
57 primitive::UintTy, 59 primitive::UintTy,
58 subst_prefix, 60 subst_prefix,
@@ -1914,6 +1916,7 @@ impl Type {
1914 substs.iter(&Interner).filter_map(|a| a.ty(&Interner)).any(go) 1916 substs.iter(&Interner).filter_map(|a| a.ty(&Interner)).any(go)
1915 } 1917 }
1916 1918
1919 TyKind::Array(_ty, len) if len.is_unknown() => true,
1917 TyKind::Array(ty, _) 1920 TyKind::Array(ty, _)
1918 | TyKind::Slice(ty) 1921 | TyKind::Slice(ty)
1919 | TyKind::Raw(_, ty) 1922 | TyKind::Raw(_, ty)