mirror of
https://github.com/rust-lang/rust-analyzer.git
synced 2025-10-02 06:41:48 +00:00
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?
This commit is contained in:
parent
77f0c92fd8
commit
dc63fea427
12 changed files with 155 additions and 110 deletions
|
@ -174,6 +174,8 @@ impl<'a> TyLoweringContext<'a> {
|
|||
}
|
||||
TypeRef::Array(inner) => {
|
||||
let inner_ty = self.lower_ty(inner);
|
||||
// FIXME: we don't have length info here because we don't store an expression for
|
||||
// the length
|
||||
TyKind::Array(inner_ty, dummy_usize_const()).intern(&Interner)
|
||||
}
|
||||
TypeRef::Slice(inner) => {
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue