1
Fork 0

make the set of methods between our two Const types more consistent

This commit is contained in:
Ralf Jung 2023-09-12 23:47:47 +02:00
parent 6e4779ab17
commit 11a4a24d8e
8 changed files with 132 additions and 174 deletions

View file

@ -257,7 +257,7 @@ impl<'tcx> TypeErrCtxtExt<'tcx> for TypeErrCtxt<'_, 'tcx> {
// Arrays give us `[]`, `[{ty}; _]` and `[{ty}; N]`
if let ty::Array(aty, len) = self_ty.kind() {
flags.push((sym::_Self, Some("[]".to_string())));
let len = len.try_to_value().and_then(|v| v.try_to_target_usize(self.tcx));
let len = len.try_to_valtree().and_then(|v| v.try_to_target_usize(self.tcx));
flags.push((sym::_Self, Some(format!("[{aty}; _]"))));
if let Some(n) = len {
flags.push((sym::_Self, Some(format!("[{aty}; {n}]"))));