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
|
@ -12,6 +12,7 @@ mod chalk_db;
|
|||
mod chalk_ext;
|
||||
mod infer;
|
||||
mod interner;
|
||||
mod consts;
|
||||
mod lower;
|
||||
mod mapping;
|
||||
mod op;
|
||||
|
@ -39,7 +40,7 @@ use chalk_ir::{
|
|||
};
|
||||
use hir_def::{expr::ExprId, type_ref::Rawness, TypeParamId};
|
||||
|
||||
use crate::{db::HirDatabase, display::HirDisplay, utils::generics};
|
||||
use crate::{consts::ConstScalar, db::HirDatabase, display::HirDisplay, utils::generics};
|
||||
|
||||
pub use autoderef::autoderef;
|
||||
pub use builder::TyBuilder;
|
||||
|
@ -250,7 +251,9 @@ pub fn dummy_usize_const() -> Const {
|
|||
let usize_ty = chalk_ir::TyKind::Scalar(Scalar::Uint(UintTy::Usize)).intern(&Interner);
|
||||
chalk_ir::ConstData {
|
||||
ty: usize_ty,
|
||||
value: chalk_ir::ConstValue::Concrete(chalk_ir::ConcreteConst { interned: () }),
|
||||
value: chalk_ir::ConstValue::Concrete(chalk_ir::ConcreteConst {
|
||||
interned: ConstScalar::Unknown,
|
||||
}),
|
||||
}
|
||||
.intern(&Interner)
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue