From f042687959ef15f9c45d7093cd6b01f137da743f Mon Sep 17 00:00:00 2001 From: varkor Date: Sat, 19 Oct 2019 18:08:54 +0100 Subject: [PATCH] Fix plural mistake in emitter.rs --- src/librustc_errors/emitter.rs | 5 +++-- src/test/ui/issues/issue-17546.stderr | 4 ++-- 2 files changed, 5 insertions(+), 4 deletions(-) diff --git a/src/librustc_errors/emitter.rs b/src/librustc_errors/emitter.rs index 1e486786f6861..e3b55a141338a 100644 --- a/src/librustc_errors/emitter.rs +++ b/src/librustc_errors/emitter.rs @@ -12,7 +12,7 @@ use Destination::*; use syntax_pos::{SourceFile, Span, MultiSpan}; use crate::{ - Level, CodeSuggestion, Diagnostic, SubDiagnostic, + Level, CodeSuggestion, Diagnostic, SubDiagnostic, pluralise, SuggestionStyle, SourceMapper, SourceMapperDyn, DiagnosticId, }; use crate::Level::Error; @@ -1572,7 +1572,8 @@ impl EmitterWriter { } } if suggestions.len() > MAX_SUGGESTIONS { - let msg = format!("and {} other candidates", suggestions.len() - MAX_SUGGESTIONS); + let others = suggestions.len() - MAX_SUGGESTIONS; + let msg = format!("and {} other candidate{}", others, pluralise!(others)); buffer.puts(row_num, max_line_num_len + 3, &msg, Style::NoStyle); } else if notice_capitalization { let msg = "notice the capitalization difference"; diff --git a/src/test/ui/issues/issue-17546.stderr b/src/test/ui/issues/issue-17546.stderr index 4a0fb186e49f6..291086d4f694e 100644 --- a/src/test/ui/issues/issue-17546.stderr +++ b/src/test/ui/issues/issue-17546.stderr @@ -27,7 +27,7 @@ LL | use std::prelude::v1::Result; | LL | use std::result::Result; | - and 1 other candidates + and 1 other candidate error[E0573]: expected type, found variant `Result` --> $DIR/issue-17546.rs:28:13 @@ -44,7 +44,7 @@ LL | use std::prelude::v1::Result; | LL | use std::result::Result; | - and 1 other candidates + and 1 other candidate error[E0573]: expected type, found variant `NoResult` --> $DIR/issue-17546.rs:33:15