Rollup merge of #64233 - varkor:correct-pluralisation, r=estebank

Correct pluralisation of various diagnostic messages
This commit is contained in:
Mazdak Farrokhzad 2019-09-07 08:06:11 +02:00 committed by GitHub
commit d5caeac096
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
9 changed files with 42 additions and 22 deletions

View file

@ -200,7 +200,9 @@ impl<'tcx> ty::TyS<'tcx> {
ty::Array(_, n) => {
let n = tcx.lift_to_global(&n).unwrap();
match n.try_eval_usize(tcx, ty::ParamEnv::empty()) {
Some(n) => format!("array of {} elements", n).into(),
Some(n) => {
format!("array of {} element{}", n, if n != 1 { "s" } else { "" }).into()
}
None => "array".into(),
}
}