use American spelling for pluralize!
This commit is contained in:
parent
1423bec54c
commit
ad550b8ef3
21 changed files with 57 additions and 57 deletions
|
@ -7,7 +7,7 @@
|
||||||
use crate::lint::{LintPass, LateLintPass, LintArray, FutureIncompatibleInfo};
|
use crate::lint::{LintPass, LateLintPass, LintArray, FutureIncompatibleInfo};
|
||||||
use crate::middle::stability;
|
use crate::middle::stability;
|
||||||
use crate::session::Session;
|
use crate::session::Session;
|
||||||
use errors::{Applicability, DiagnosticBuilder, pluralise};
|
use errors::{Applicability, DiagnosticBuilder, pluralize};
|
||||||
use syntax::ast;
|
use syntax::ast;
|
||||||
use syntax::edition::Edition;
|
use syntax::edition::Edition;
|
||||||
use syntax::source_map::Span;
|
use syntax::source_map::Span;
|
||||||
|
@ -651,7 +651,7 @@ pub(crate) fn add_elided_lifetime_in_path_suggestion(
|
||||||
};
|
};
|
||||||
db.span_suggestion(
|
db.span_suggestion(
|
||||||
replace_span,
|
replace_span,
|
||||||
&format!("indicate the anonymous lifetime{}", pluralise!(n)),
|
&format!("indicate the anonymous lifetime{}", pluralize!(n)),
|
||||||
suggestion,
|
suggestion,
|
||||||
Applicability::MachineApplicable
|
Applicability::MachineApplicable
|
||||||
);
|
);
|
||||||
|
|
|
@ -17,7 +17,7 @@ use crate::ty::{self, DefIdTree, GenericParamDefKind, TyCtxt};
|
||||||
use crate::rustc::lint;
|
use crate::rustc::lint;
|
||||||
use crate::session::Session;
|
use crate::session::Session;
|
||||||
use crate::util::nodemap::{DefIdMap, FxHashMap, FxHashSet, HirIdMap, HirIdSet};
|
use crate::util::nodemap::{DefIdMap, FxHashMap, FxHashSet, HirIdMap, HirIdSet};
|
||||||
use errors::{Applicability, DiagnosticBuilder, pluralise};
|
use errors::{Applicability, DiagnosticBuilder, pluralize};
|
||||||
use rustc_macros::HashStable;
|
use rustc_macros::HashStable;
|
||||||
use std::borrow::Cow;
|
use std::borrow::Cow;
|
||||||
use std::cell::Cell;
|
use std::cell::Cell;
|
||||||
|
@ -3044,7 +3044,7 @@ pub fn report_missing_lifetime_specifiers(
|
||||||
span,
|
span,
|
||||||
E0106,
|
E0106,
|
||||||
"missing lifetime specifier{}",
|
"missing lifetime specifier{}",
|
||||||
pluralise!(count)
|
pluralize!(count)
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -33,7 +33,7 @@ use crate::ty::subst::Subst;
|
||||||
use crate::ty::SubtypePredicate;
|
use crate::ty::SubtypePredicate;
|
||||||
use crate::util::nodemap::{FxHashMap, FxHashSet};
|
use crate::util::nodemap::{FxHashMap, FxHashSet};
|
||||||
|
|
||||||
use errors::{Applicability, DiagnosticBuilder, pluralise};
|
use errors::{Applicability, DiagnosticBuilder, pluralize};
|
||||||
use std::fmt;
|
use std::fmt;
|
||||||
use syntax::ast;
|
use syntax::ast;
|
||||||
use syntax::symbol::{sym, kw};
|
use syntax::symbol::{sym, kw};
|
||||||
|
@ -1553,7 +1553,7 @@ impl<'a, 'tcx> InferCtxt<'a, 'tcx> {
|
||||||
_ => format!("{} {}argument{}",
|
_ => format!("{} {}argument{}",
|
||||||
arg_length,
|
arg_length,
|
||||||
if distinct && arg_length > 1 { "distinct " } else { "" },
|
if distinct && arg_length > 1 { "distinct " } else { "" },
|
||||||
pluralise!(arg_length))
|
pluralize!(arg_length))
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
|
@ -4,7 +4,7 @@ use std::borrow::Cow;
|
||||||
use std::fmt;
|
use std::fmt;
|
||||||
use rustc_target::spec::abi;
|
use rustc_target::spec::abi;
|
||||||
use syntax::ast;
|
use syntax::ast;
|
||||||
use syntax::errors::pluralise;
|
use syntax::errors::pluralize;
|
||||||
use errors::{Applicability, DiagnosticBuilder};
|
use errors::{Applicability, DiagnosticBuilder};
|
||||||
use syntax_pos::Span;
|
use syntax_pos::Span;
|
||||||
|
|
||||||
|
@ -100,17 +100,17 @@ impl<'tcx> fmt::Display for TypeError<'tcx> {
|
||||||
write!(f, "expected a tuple with {} element{}, \
|
write!(f, "expected a tuple with {} element{}, \
|
||||||
found one with {} element{}",
|
found one with {} element{}",
|
||||||
values.expected,
|
values.expected,
|
||||||
pluralise!(values.expected),
|
pluralize!(values.expected),
|
||||||
values.found,
|
values.found,
|
||||||
pluralise!(values.found))
|
pluralize!(values.found))
|
||||||
}
|
}
|
||||||
FixedArraySize(values) => {
|
FixedArraySize(values) => {
|
||||||
write!(f, "expected an array with a fixed size of {} element{}, \
|
write!(f, "expected an array with a fixed size of {} element{}, \
|
||||||
found one with {} element{}",
|
found one with {} element{}",
|
||||||
values.expected,
|
values.expected,
|
||||||
pluralise!(values.expected),
|
pluralize!(values.expected),
|
||||||
values.found,
|
values.found,
|
||||||
pluralise!(values.found))
|
pluralize!(values.found))
|
||||||
}
|
}
|
||||||
ArgCount => {
|
ArgCount => {
|
||||||
write!(f, "incorrect number of function parameters")
|
write!(f, "incorrect number of function parameters")
|
||||||
|
@ -165,7 +165,7 @@ impl<'tcx> fmt::Display for TypeError<'tcx> {
|
||||||
ProjectionBoundsLength(ref values) => {
|
ProjectionBoundsLength(ref values) => {
|
||||||
write!(f, "expected {} associated type binding{}, found {}",
|
write!(f, "expected {} associated type binding{}, found {}",
|
||||||
values.expected,
|
values.expected,
|
||||||
pluralise!(values.expected),
|
pluralize!(values.expected),
|
||||||
values.found)
|
values.found)
|
||||||
},
|
},
|
||||||
ExistentialMismatch(ref values) => {
|
ExistentialMismatch(ref values) => {
|
||||||
|
@ -196,7 +196,7 @@ impl<'tcx> ty::TyS<'tcx> {
|
||||||
let n = tcx.lift(&n).unwrap();
|
let n = tcx.lift(&n).unwrap();
|
||||||
match n.try_eval_usize(tcx, ty::ParamEnv::empty()) {
|
match n.try_eval_usize(tcx, ty::ParamEnv::empty()) {
|
||||||
Some(n) => {
|
Some(n) => {
|
||||||
format!("array of {} element{}", n, pluralise!(n)).into()
|
format!("array of {} element{}", n, pluralize!(n)).into()
|
||||||
}
|
}
|
||||||
None => "array".into(),
|
None => "array".into(),
|
||||||
}
|
}
|
||||||
|
|
|
@ -12,7 +12,7 @@ use Destination::*;
|
||||||
use syntax_pos::{SourceFile, Span, MultiSpan};
|
use syntax_pos::{SourceFile, Span, MultiSpan};
|
||||||
|
|
||||||
use crate::{
|
use crate::{
|
||||||
Level, CodeSuggestion, Diagnostic, SubDiagnostic, pluralise,
|
Level, CodeSuggestion, Diagnostic, SubDiagnostic, pluralize,
|
||||||
SuggestionStyle, SourceMapper, SourceMapperDyn, DiagnosticId,
|
SuggestionStyle, SourceMapper, SourceMapperDyn, DiagnosticId,
|
||||||
};
|
};
|
||||||
use crate::Level::Error;
|
use crate::Level::Error;
|
||||||
|
@ -1573,7 +1573,7 @@ impl EmitterWriter {
|
||||||
}
|
}
|
||||||
if suggestions.len() > MAX_SUGGESTIONS {
|
if suggestions.len() > MAX_SUGGESTIONS {
|
||||||
let others = suggestions.len() - MAX_SUGGESTIONS;
|
let others = suggestions.len() - MAX_SUGGESTIONS;
|
||||||
let msg = format!("and {} other candidate{}", others, pluralise!(others));
|
let msg = format!("and {} other candidate{}", others, pluralize!(others));
|
||||||
buffer.puts(row_num, max_line_num_len + 3, &msg, Style::NoStyle);
|
buffer.puts(row_num, max_line_num_len + 3, &msg, Style::NoStyle);
|
||||||
} else if notice_capitalization {
|
} else if notice_capitalization {
|
||||||
let msg = "notice the capitalization difference";
|
let msg = "notice the capitalization difference";
|
||||||
|
|
|
@ -1027,7 +1027,7 @@ impl Level {
|
||||||
}
|
}
|
||||||
|
|
||||||
#[macro_export]
|
#[macro_export]
|
||||||
macro_rules! pluralise {
|
macro_rules! pluralize {
|
||||||
($x:expr) => {
|
($x:expr) => {
|
||||||
if $x != 1 { "s" } else { "" }
|
if $x != 1 { "s" } else { "" }
|
||||||
};
|
};
|
||||||
|
|
|
@ -10,7 +10,7 @@ use lint::{LintPass, EarlyLintPass, LateLintPass};
|
||||||
|
|
||||||
use syntax::ast;
|
use syntax::ast;
|
||||||
use syntax::attr;
|
use syntax::attr;
|
||||||
use syntax::errors::{Applicability, pluralise};
|
use syntax::errors::{Applicability, pluralize};
|
||||||
use syntax::feature_gate::{AttributeType, BuiltinAttribute, BUILTIN_ATTRIBUTE_MAP};
|
use syntax::feature_gate::{AttributeType, BuiltinAttribute, BUILTIN_ATTRIBUTE_MAP};
|
||||||
use syntax::print::pprust;
|
use syntax::print::pprust;
|
||||||
use syntax::symbol::{kw, sym};
|
use syntax::symbol::{kw, sym};
|
||||||
|
@ -144,7 +144,7 @@ impl<'a, 'tcx> LateLintPass<'a, 'tcx> for UnusedResults {
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
let plural_suffix = pluralise!(plural_len);
|
let plural_suffix = pluralize!(plural_len);
|
||||||
|
|
||||||
match ty.kind {
|
match ty.kind {
|
||||||
ty::Adt(..) if ty.is_box() => {
|
ty::Adt(..) if ty.is_box() => {
|
||||||
|
|
|
@ -548,7 +548,7 @@ fn joined_uncovered_patterns(witnesses: &[super::Pat<'_>]) -> String {
|
||||||
}
|
}
|
||||||
|
|
||||||
fn pattern_not_covered_label(witnesses: &[super::Pat<'_>], joined_patterns: &str) -> String {
|
fn pattern_not_covered_label(witnesses: &[super::Pat<'_>], joined_patterns: &str) -> String {
|
||||||
format!("pattern{} {} not covered", rustc_errors::pluralise!(witnesses.len()), joined_patterns)
|
format!("pattern{} {} not covered", rustc_errors::pluralize!(witnesses.len()), joined_patterns)
|
||||||
}
|
}
|
||||||
|
|
||||||
/// Point at the definition of non-covered `enum` variants.
|
/// Point at the definition of non-covered `enum` variants.
|
||||||
|
|
|
@ -26,7 +26,7 @@
|
||||||
use crate::Resolver;
|
use crate::Resolver;
|
||||||
use crate::resolve_imports::ImportDirectiveSubclass;
|
use crate::resolve_imports::ImportDirectiveSubclass;
|
||||||
|
|
||||||
use errors::pluralise;
|
use errors::pluralize;
|
||||||
|
|
||||||
use rustc::util::nodemap::NodeMap;
|
use rustc::util::nodemap::NodeMap;
|
||||||
use rustc::{lint, ty};
|
use rustc::{lint, ty};
|
||||||
|
@ -297,7 +297,7 @@ impl Resolver<'_> {
|
||||||
}).collect::<Vec<String>>();
|
}).collect::<Vec<String>>();
|
||||||
span_snippets.sort();
|
span_snippets.sort();
|
||||||
let msg = format!("unused import{}{}",
|
let msg = format!("unused import{}{}",
|
||||||
pluralise!(len),
|
pluralize!(len),
|
||||||
if !span_snippets.is_empty() {
|
if !span_snippets.is_empty() {
|
||||||
format!(": {}", span_snippets.join(", "))
|
format!(": {}", span_snippets.join(", "))
|
||||||
} else {
|
} else {
|
||||||
|
|
|
@ -11,7 +11,7 @@ use crate::{Resolver, ResolutionError, BindingKey, Segment, ModuleKind};
|
||||||
use crate::{names_to_string, module_to_string};
|
use crate::{names_to_string, module_to_string};
|
||||||
use crate::diagnostics::Suggestion;
|
use crate::diagnostics::Suggestion;
|
||||||
|
|
||||||
use errors::{Applicability, pluralise};
|
use errors::{Applicability, pluralize};
|
||||||
|
|
||||||
use rustc_data_structures::ptr_key::PtrKey;
|
use rustc_data_structures::ptr_key::PtrKey;
|
||||||
use rustc::ty;
|
use rustc::ty;
|
||||||
|
@ -730,7 +730,7 @@ impl<'a, 'b> ImportResolver<'a, 'b> {
|
||||||
|
|
||||||
let msg = format!(
|
let msg = format!(
|
||||||
"unresolved import{} {}",
|
"unresolved import{} {}",
|
||||||
pluralise!(paths.len()),
|
pluralize!(paths.len()),
|
||||||
paths.join(", "),
|
paths.join(", "),
|
||||||
);
|
);
|
||||||
|
|
||||||
|
|
|
@ -23,7 +23,7 @@ use rustc_target::spec::abi;
|
||||||
use crate::require_c_abi_if_c_variadic;
|
use crate::require_c_abi_if_c_variadic;
|
||||||
use smallvec::SmallVec;
|
use smallvec::SmallVec;
|
||||||
use syntax::ast;
|
use syntax::ast;
|
||||||
use syntax::errors::pluralise;
|
use syntax::errors::pluralize;
|
||||||
use syntax::feature_gate::{GateIssue, emit_feature_err};
|
use syntax::feature_gate::{GateIssue, emit_feature_err};
|
||||||
use syntax::util::lev_distance::find_best_match_for_name;
|
use syntax::util::lev_distance::find_best_match_for_name;
|
||||||
use syntax::symbol::sym;
|
use syntax::symbol::sym;
|
||||||
|
@ -392,7 +392,7 @@ impl<'o, 'tcx> dyn AstConv<'tcx> + 'o {
|
||||||
quantifier,
|
quantifier,
|
||||||
bound,
|
bound,
|
||||||
kind,
|
kind,
|
||||||
pluralise!(bound),
|
pluralize!(bound),
|
||||||
))
|
))
|
||||||
};
|
};
|
||||||
|
|
||||||
|
@ -1360,7 +1360,7 @@ impl<'o, 'tcx> dyn AstConv<'tcx> + 'o {
|
||||||
span,
|
span,
|
||||||
E0191,
|
E0191,
|
||||||
"the value of the associated type{} {} must be specified",
|
"the value of the associated type{} {} must be specified",
|
||||||
pluralise!(associated_types.len()),
|
pluralize!(associated_types.len()),
|
||||||
names,
|
names,
|
||||||
);
|
);
|
||||||
let (suggest, potential_assoc_types_spans) =
|
let (suggest, potential_assoc_types_spans) =
|
||||||
|
|
|
@ -10,7 +10,7 @@ use rustc::util::common::ErrorReported;
|
||||||
use errors::{Applicability, DiagnosticId};
|
use errors::{Applicability, DiagnosticId};
|
||||||
|
|
||||||
use syntax_pos::Span;
|
use syntax_pos::Span;
|
||||||
use syntax::errors::pluralise;
|
use syntax::errors::pluralize;
|
||||||
|
|
||||||
use super::{Inherited, FnCtxt, potentially_plural_count};
|
use super::{Inherited, FnCtxt, potentially_plural_count};
|
||||||
|
|
||||||
|
@ -649,9 +649,9 @@ fn compare_number_of_generics<'tcx>(
|
||||||
declaration has {} {kind} parameter{}",
|
declaration has {} {kind} parameter{}",
|
||||||
trait_.ident,
|
trait_.ident,
|
||||||
impl_count,
|
impl_count,
|
||||||
pluralise!(impl_count),
|
pluralize!(impl_count),
|
||||||
trait_count,
|
trait_count,
|
||||||
pluralise!(trait_count),
|
pluralize!(trait_count),
|
||||||
kind = kind,
|
kind = kind,
|
||||||
),
|
),
|
||||||
DiagnosticId::Error("E0049".into()),
|
DiagnosticId::Error("E0049".into()),
|
||||||
|
@ -666,7 +666,7 @@ fn compare_number_of_generics<'tcx>(
|
||||||
"expected {} {} parameter{}",
|
"expected {} {} parameter{}",
|
||||||
trait_count,
|
trait_count,
|
||||||
kind,
|
kind,
|
||||||
pluralise!(trait_count),
|
pluralize!(trait_count),
|
||||||
));
|
));
|
||||||
}
|
}
|
||||||
for span in spans {
|
for span in spans {
|
||||||
|
@ -681,7 +681,7 @@ fn compare_number_of_generics<'tcx>(
|
||||||
"found {} {} parameter{}{}",
|
"found {} {} parameter{}{}",
|
||||||
impl_count,
|
impl_count,
|
||||||
kind,
|
kind,
|
||||||
pluralise!(impl_count),
|
pluralize!(impl_count),
|
||||||
suffix.unwrap_or_else(|| String::new()),
|
suffix.unwrap_or_else(|| String::new()),
|
||||||
));
|
));
|
||||||
}
|
}
|
||||||
|
|
|
@ -17,7 +17,7 @@ use crate::util::common::ErrorReported;
|
||||||
use crate::util::nodemap::FxHashMap;
|
use crate::util::nodemap::FxHashMap;
|
||||||
use crate::astconv::AstConv as _;
|
use crate::astconv::AstConv as _;
|
||||||
|
|
||||||
use errors::{Applicability, DiagnosticBuilder, pluralise};
|
use errors::{Applicability, DiagnosticBuilder, pluralize};
|
||||||
use syntax_pos::hygiene::DesugaringKind;
|
use syntax_pos::hygiene::DesugaringKind;
|
||||||
use syntax::ast;
|
use syntax::ast;
|
||||||
use syntax::symbol::{Symbol, kw, sym};
|
use syntax::symbol::{Symbol, kw, sym};
|
||||||
|
@ -1210,7 +1210,7 @@ impl<'a, 'tcx> FnCtxt<'a, 'tcx> {
|
||||||
|
|
||||||
struct_span_err!(tcx.sess, span, E0063,
|
struct_span_err!(tcx.sess, span, E0063,
|
||||||
"missing field{} {}{} in initializer of `{}`",
|
"missing field{} {}{} in initializer of `{}`",
|
||||||
pluralise!(remaining_fields.len()),
|
pluralize!(remaining_fields.len()),
|
||||||
remaining_fields_names,
|
remaining_fields_names,
|
||||||
truncated_fields_error,
|
truncated_fields_error,
|
||||||
adt_ty)
|
adt_ty)
|
||||||
|
|
|
@ -5,7 +5,7 @@ use crate::check::FnCtxt;
|
||||||
use crate::middle::lang_items::FnOnceTraitLangItem;
|
use crate::middle::lang_items::FnOnceTraitLangItem;
|
||||||
use crate::namespace::Namespace;
|
use crate::namespace::Namespace;
|
||||||
use crate::util::nodemap::FxHashSet;
|
use crate::util::nodemap::FxHashSet;
|
||||||
use errors::{Applicability, DiagnosticBuilder, pluralise};
|
use errors::{Applicability, DiagnosticBuilder, pluralize};
|
||||||
use rustc::hir::{self, ExprKind, Node, QPath};
|
use rustc::hir::{self, ExprKind, Node, QPath};
|
||||||
use rustc::hir::def::{Res, DefKind};
|
use rustc::hir::def::{Res, DefKind};
|
||||||
use rustc::hir::def_id::{CRATE_DEF_INDEX, LOCAL_CRATE, DefId};
|
use rustc::hir::def_id::{CRATE_DEF_INDEX, LOCAL_CRATE, DefId};
|
||||||
|
@ -601,7 +601,7 @@ impl<'a, 'tcx> FnCtxt<'a, 'tcx> {
|
||||||
"{an}other candidate{s} {were} found in the following trait{s}, perhaps \
|
"{an}other candidate{s} {were} found in the following trait{s}, perhaps \
|
||||||
add a `use` for {one_of_them}:",
|
add a `use` for {one_of_them}:",
|
||||||
an = if candidates.len() == 1 {"an" } else { "" },
|
an = if candidates.len() == 1 {"an" } else { "" },
|
||||||
s = pluralise!(candidates.len()),
|
s = pluralize!(candidates.len()),
|
||||||
were = if candidates.len() == 1 { "was" } else { "were" },
|
were = if candidates.len() == 1 { "was" } else { "were" },
|
||||||
one_of_them = if candidates.len() == 1 {
|
one_of_them = if candidates.len() == 1 {
|
||||||
"it"
|
"it"
|
||||||
|
|
|
@ -88,7 +88,7 @@ pub mod intrinsic;
|
||||||
mod op;
|
mod op;
|
||||||
|
|
||||||
use crate::astconv::{AstConv, PathSeg};
|
use crate::astconv::{AstConv, PathSeg};
|
||||||
use errors::{Applicability, DiagnosticBuilder, DiagnosticId, pluralise};
|
use errors::{Applicability, DiagnosticBuilder, DiagnosticId, pluralize};
|
||||||
use rustc::hir::{self, ExprKind, GenericArg, ItemKind, Node, PatKind, QPath};
|
use rustc::hir::{self, ExprKind, GenericArg, ItemKind, Node, PatKind, QPath};
|
||||||
use rustc::hir::def::{CtorOf, Res, DefKind};
|
use rustc::hir::def::{CtorOf, Res, DefKind};
|
||||||
use rustc::hir::def_id::{CrateNum, DefId, LOCAL_CRATE};
|
use rustc::hir::def_id::{CrateNum, DefId, LOCAL_CRATE};
|
||||||
|
@ -5167,5 +5167,5 @@ fn fatally_break_rust(sess: &Session) {
|
||||||
}
|
}
|
||||||
|
|
||||||
fn potentially_plural_count(count: usize, word: &str) -> String {
|
fn potentially_plural_count(count: usize, word: &str) -> String {
|
||||||
format!("{} {}{}", count, word, pluralise!(count))
|
format!("{} {}{}", count, word, pluralize!(count))
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,6 +1,6 @@
|
||||||
use crate::check::FnCtxt;
|
use crate::check::FnCtxt;
|
||||||
use crate::util::nodemap::FxHashMap;
|
use crate::util::nodemap::FxHashMap;
|
||||||
use errors::{Applicability, DiagnosticBuilder, pluralise};
|
use errors::{Applicability, DiagnosticBuilder, pluralize};
|
||||||
use rustc::hir::{self, PatKind, Pat, HirId};
|
use rustc::hir::{self, PatKind, Pat, HirId};
|
||||||
use rustc::hir::def::{Res, DefKind, CtorKind};
|
use rustc::hir::def::{Res, DefKind, CtorKind};
|
||||||
use rustc::hir::pat_util::EnumerateAndAdjustIterator;
|
use rustc::hir::pat_util::EnumerateAndAdjustIterator;
|
||||||
|
@ -703,8 +703,8 @@ impl<'a, 'tcx> FnCtxt<'a, 'tcx> {
|
||||||
fields: &[ty::FieldDef],
|
fields: &[ty::FieldDef],
|
||||||
expected: Ty<'tcx>
|
expected: Ty<'tcx>
|
||||||
) {
|
) {
|
||||||
let subpats_ending = pluralise!(subpats.len());
|
let subpats_ending = pluralize!(subpats.len());
|
||||||
let fields_ending = pluralise!(fields.len());
|
let fields_ending = pluralize!(fields.len());
|
||||||
let res_span = self.tcx.def_span(res.def_id());
|
let res_span = self.tcx.def_span(res.def_id());
|
||||||
let mut err = struct_span_err!(
|
let mut err = struct_span_err!(
|
||||||
self.tcx.sess,
|
self.tcx.sess,
|
||||||
|
@ -1174,10 +1174,10 @@ impl<'a, 'tcx> FnCtxt<'a, 'tcx> {
|
||||||
E0527,
|
E0527,
|
||||||
"pattern requires {} element{} but array has {}",
|
"pattern requires {} element{} but array has {}",
|
||||||
min_len,
|
min_len,
|
||||||
pluralise!(min_len),
|
pluralize!(min_len),
|
||||||
size,
|
size,
|
||||||
)
|
)
|
||||||
.span_label(span, format!("expected {} element{}", size, pluralise!(size)))
|
.span_label(span, format!("expected {} element{}", size, pluralize!(size)))
|
||||||
.emit();
|
.emit();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -1188,14 +1188,14 @@ impl<'a, 'tcx> FnCtxt<'a, 'tcx> {
|
||||||
E0528,
|
E0528,
|
||||||
"pattern requires at least {} element{} but array has {}",
|
"pattern requires at least {} element{} but array has {}",
|
||||||
min_len,
|
min_len,
|
||||||
pluralise!(min_len),
|
pluralize!(min_len),
|
||||||
size,
|
size,
|
||||||
).span_label(
|
).span_label(
|
||||||
span,
|
span,
|
||||||
format!(
|
format!(
|
||||||
"pattern cannot match array of {} element{}",
|
"pattern cannot match array of {} element{}",
|
||||||
size,
|
size,
|
||||||
pluralise!(size),
|
pluralize!(size),
|
||||||
),
|
),
|
||||||
).emit();
|
).emit();
|
||||||
}
|
}
|
||||||
|
|
|
@ -12,7 +12,7 @@ use crate::ptr::P;
|
||||||
use crate::symbol::{kw, sym};
|
use crate::symbol::{kw, sym};
|
||||||
use crate::ThinVec;
|
use crate::ThinVec;
|
||||||
use crate::util::parser::AssocOp;
|
use crate::util::parser::AssocOp;
|
||||||
use errors::{Applicability, DiagnosticBuilder, DiagnosticId, pluralise};
|
use errors::{Applicability, DiagnosticBuilder, DiagnosticId, pluralize};
|
||||||
use rustc_data_structures::fx::FxHashSet;
|
use rustc_data_structures::fx::FxHashSet;
|
||||||
use syntax_pos::{Span, DUMMY_SP, MultiSpan, SpanSnippetError};
|
use syntax_pos::{Span, DUMMY_SP, MultiSpan, SpanSnippetError};
|
||||||
use log::{debug, trace};
|
use log::{debug, trace};
|
||||||
|
@ -515,11 +515,11 @@ impl<'a> Parser<'a> {
|
||||||
self.diagnostic()
|
self.diagnostic()
|
||||||
.struct_span_err(
|
.struct_span_err(
|
||||||
span,
|
span,
|
||||||
&format!("unmatched angle bracket{}", pluralise!(total_num_of_gt)),
|
&format!("unmatched angle bracket{}", pluralize!(total_num_of_gt)),
|
||||||
)
|
)
|
||||||
.span_suggestion(
|
.span_suggestion(
|
||||||
span,
|
span,
|
||||||
&format!("remove extra angle bracket{}", pluralise!(total_num_of_gt)),
|
&format!("remove extra angle bracket{}", pluralize!(total_num_of_gt)),
|
||||||
String::new(),
|
String::new(),
|
||||||
Applicability::MachineApplicable,
|
Applicability::MachineApplicable,
|
||||||
)
|
)
|
||||||
|
|
|
@ -9,7 +9,7 @@ use crate::symbol::kw;
|
||||||
|
|
||||||
use std::mem;
|
use std::mem;
|
||||||
use log::debug;
|
use log::debug;
|
||||||
use errors::{Applicability, pluralise};
|
use errors::{Applicability, pluralize};
|
||||||
|
|
||||||
/// Specifies how to parse a path.
|
/// Specifies how to parse a path.
|
||||||
#[derive(Copy, Clone, PartialEq)]
|
#[derive(Copy, Clone, PartialEq)]
|
||||||
|
@ -368,14 +368,14 @@ impl<'a> Parser<'a> {
|
||||||
span,
|
span,
|
||||||
&format!(
|
&format!(
|
||||||
"unmatched angle bracket{}",
|
"unmatched angle bracket{}",
|
||||||
pluralise!(snapshot.unmatched_angle_bracket_count)
|
pluralize!(snapshot.unmatched_angle_bracket_count)
|
||||||
),
|
),
|
||||||
)
|
)
|
||||||
.span_suggestion(
|
.span_suggestion(
|
||||||
span,
|
span,
|
||||||
&format!(
|
&format!(
|
||||||
"remove extra angle bracket{}",
|
"remove extra angle bracket{}",
|
||||||
pluralise!(snapshot.unmatched_angle_bracket_count)
|
pluralize!(snapshot.unmatched_angle_bracket_count)
|
||||||
),
|
),
|
||||||
String::new(),
|
String::new(),
|
||||||
Applicability::MachineApplicable,
|
Applicability::MachineApplicable,
|
||||||
|
|
|
@ -10,7 +10,7 @@ use crate::parse::token::{self, Token};
|
||||||
use crate::source_map::Span;
|
use crate::source_map::Span;
|
||||||
use crate::symbol::{kw};
|
use crate::symbol::{kw};
|
||||||
|
|
||||||
use errors::{Applicability, pluralise};
|
use errors::{Applicability, pluralize};
|
||||||
|
|
||||||
/// Returns `true` if `IDENT t` can start a type -- `IDENT::a::b`, `IDENT<u8, u8>`,
|
/// Returns `true` if `IDENT t` can start a type -- `IDENT::a::b`, `IDENT<u8, u8>`,
|
||||||
/// `IDENT<<u8 as Trait>::AssocTy>`.
|
/// `IDENT<<u8 as Trait>::AssocTy>`.
|
||||||
|
@ -412,7 +412,7 @@ impl<'a> Parser<'a> {
|
||||||
}
|
}
|
||||||
err.span_suggestion_hidden(
|
err.span_suggestion_hidden(
|
||||||
bound_list,
|
bound_list,
|
||||||
&format!("remove the trait bound{}", pluralise!(negative_bounds_len)),
|
&format!("remove the trait bound{}", pluralize!(negative_bounds_len)),
|
||||||
new_bound_list,
|
new_bound_list,
|
||||||
Applicability::MachineApplicable,
|
Applicability::MachineApplicable,
|
||||||
);
|
);
|
||||||
|
|
|
@ -9,7 +9,7 @@ use syntax::tokenstream::{DelimSpan, TokenStream, TokenTree, TreeAndJoint};
|
||||||
|
|
||||||
use smallvec::{smallvec, SmallVec};
|
use smallvec::{smallvec, SmallVec};
|
||||||
|
|
||||||
use errors::pluralise;
|
use errors::pluralize;
|
||||||
use rustc_data_structures::fx::FxHashMap;
|
use rustc_data_structures::fx::FxHashMap;
|
||||||
use rustc_data_structures::sync::Lrc;
|
use rustc_data_structures::sync::Lrc;
|
||||||
use syntax_pos::hygiene::{ExpnId, Transparency};
|
use syntax_pos::hygiene::{ExpnId, Transparency};
|
||||||
|
@ -350,10 +350,10 @@ impl LockstepIterSize {
|
||||||
"meta-variable `{}` repeats {} time{}, but `{}` repeats {} time{}",
|
"meta-variable `{}` repeats {} time{}, but `{}` repeats {} time{}",
|
||||||
l_id,
|
l_id,
|
||||||
l_len,
|
l_len,
|
||||||
pluralise!(l_len),
|
pluralize!(l_len),
|
||||||
r_id,
|
r_id,
|
||||||
r_len,
|
r_len,
|
||||||
pluralise!(r_len),
|
pluralize!(r_len),
|
||||||
);
|
);
|
||||||
LockstepIterSize::Contradiction(msg)
|
LockstepIterSize::Contradiction(msg)
|
||||||
}
|
}
|
||||||
|
|
|
@ -5,7 +5,7 @@ use fmt_macros as parse;
|
||||||
|
|
||||||
use errors::DiagnosticBuilder;
|
use errors::DiagnosticBuilder;
|
||||||
use errors::Applicability;
|
use errors::Applicability;
|
||||||
use errors::pluralise;
|
use errors::pluralize;
|
||||||
|
|
||||||
use syntax::ast;
|
use syntax::ast;
|
||||||
use syntax_expand::base::{self, *};
|
use syntax_expand::base::{self, *};
|
||||||
|
@ -300,7 +300,7 @@ impl<'a, 'b> Context<'a, 'b> {
|
||||||
&format!(
|
&format!(
|
||||||
"{} positional argument{} in format string, but {}",
|
"{} positional argument{} in format string, but {}",
|
||||||
count,
|
count,
|
||||||
pluralise!(count),
|
pluralize!(count),
|
||||||
self.describe_num_args(),
|
self.describe_num_args(),
|
||||||
),
|
),
|
||||||
);
|
);
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue