1
Fork 0

Simplify array length mismatch error reporting

This commit is contained in:
Michael Goulet 2024-11-23 05:02:18 +00:00
parent e48241b5d1
commit 28970a2cb0
18 changed files with 60 additions and 71 deletions

View file

@ -151,10 +151,6 @@ impl<'tcx> Const<'tcx> {
}
impl<'tcx> rustc_type_ir::inherent::Const<TyCtxt<'tcx>> for Const<'tcx> {
fn try_to_target_usize(self, interner: TyCtxt<'tcx>) -> Option<u64> {
self.try_to_target_usize(interner)
}
fn new_infer(tcx: TyCtxt<'tcx>, infer: ty::InferConst) -> Self {
Const::new_infer(tcx, infer)
}

View file

@ -58,12 +58,9 @@ impl<'tcx> TypeError<'tcx> {
pluralize!(values.found)
)
.into(),
TypeError::FixedArraySize(values) => format!(
"expected an array with a fixed size of {} element{}, found one with {} element{}",
values.expected,
pluralize!(values.expected),
values.found,
pluralize!(values.found)
TypeError::ArraySize(values) => format!(
"expected an array with a size of {}, found one with a size of {}",
values.expected, values.found,
)
.into(),
TypeError::ArgCount => "incorrect number of function parameters".into(),