mirror of
https://github.com/rust-lang/rust-analyzer.git
synced 2025-09-28 04:44:57 +00:00
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 <software@lfcode.ca>
This commit is contained in:
commit
a57bd59f35
21 changed files with 427 additions and 136 deletions
|
@ -52,7 +52,9 @@ use hir_def::{
|
|||
};
|
||||
use hir_expand::{diagnostics::DiagnosticSink, name::name, MacroDefKind};
|
||||
use hir_ty::{
|
||||
autoderef, could_unify,
|
||||
autoderef,
|
||||
consteval::ConstExt,
|
||||
could_unify,
|
||||
method_resolution::{self, def_crates, TyFingerprint},
|
||||
primitive::UintTy,
|
||||
subst_prefix,
|
||||
|
@ -1914,6 +1916,7 @@ impl Type {
|
|||
substs.iter(&Interner).filter_map(|a| a.ty(&Interner)).any(go)
|
||||
}
|
||||
|
||||
TyKind::Array(_ty, len) if len.is_unknown() => true,
|
||||
TyKind::Array(ty, _)
|
||||
| TyKind::Slice(ty)
|
||||
| TyKind::Raw(_, ty)
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue