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:
Jade 2021-05-11 05:06:33 -07:00
parent 77f0c92fd8
commit dc63fea427
12 changed files with 155 additions and 110 deletions

View file

@ -308,7 +308,7 @@ impl HirDisplay for Const {
let param_data = &generics.params.consts[id.local_id];
write!(f, "{}", param_data.name)
}
ConstValue::Concrete(_) => write!(f, "_"),
ConstValue::Concrete(c) => write!(f, "{}", c.interned),
}
}
}