Skip to content

Commit d6a7e74

Browse files
committed
Combined 4 commits into 1
Fixed numerus of error message Removed superfluous argument Using pluralize!() instead of code duplication Adjusted a test
1 parent f03eb6b commit d6a7e74

File tree

2 files changed

+11
-5
lines changed

2 files changed

+11
-5
lines changed

compiler/rustc_trait_selection/src/traits/error_reporting/suggestions.rs

+8-2
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,9 @@ use crate::traits::normalize_projection_type;
1010
use rustc_data_structures::fx::FxHashSet;
1111
use rustc_data_structures::stack::ensure_sufficient_stack;
1212
use rustc_data_structures::sync::Lrc;
13-
use rustc_errors::{error_code, struct_span_err, Applicability, DiagnosticBuilder, Style};
13+
use rustc_errors::{
14+
error_code, pluralize, struct_span_err, Applicability, DiagnosticBuilder, Style,
15+
};
1416
use rustc_hir as hir;
1517
use rustc_hir::def::DefKind;
1618
use rustc_hir::def_id::DefId;
@@ -2273,7 +2275,11 @@ impl<'a, 'tcx> InferCtxtExt<'tcx> for InferCtxt<'a, 'tcx> {
22732275
parent_trait_ref = child_trait_ref;
22742276
}
22752277
if count > 0 {
2276-
err.note(&format!("{} redundant requirements hidden", count));
2278+
err.note(&format!(
2279+
"{} redundant requirement{} hidden",
2280+
count,
2281+
pluralize!(count)
2282+
));
22772283
err.note(&format!(
22782284
"required because of the requirements on the impl of `{}` for `{}`",
22792285
parent_trait_ref.print_only_trait_path(),

src/test/ui/associated-types/impl-wf-cycle-1.stderr

+3-3
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@ note: required because of the requirements on the impl of `Grault` for `(T,)`
1515
|
1616
LL | impl<T: Grault> Grault for (T,)
1717
| ^^^^^^ ^^^^
18-
= note: 1 redundant requirements hidden
18+
= note: 1 redundant requirement hidden
1919
= note: required because of the requirements on the impl of `Grault` for `(T,)`
2020

2121
error[E0275]: overflow evaluating the requirement `<(T,) as Grault>::A == _`
@@ -29,7 +29,7 @@ note: required because of the requirements on the impl of `Grault` for `(T,)`
2929
|
3030
LL | impl<T: Grault> Grault for (T,)
3131
| ^^^^^^ ^^^^
32-
= note: 1 redundant requirements hidden
32+
= note: 1 redundant requirement hidden
3333
= note: required because of the requirements on the impl of `Grault` for `(T,)`
3434

3535
error[E0275]: overflow evaluating the requirement `<(T,) as Grault>::A == _`
@@ -43,7 +43,7 @@ note: required because of the requirements on the impl of `Grault` for `(T,)`
4343
|
4444
LL | impl<T: Grault> Grault for (T,)
4545
| ^^^^^^ ^^^^
46-
= note: 1 redundant requirements hidden
46+
= note: 1 redundant requirement hidden
4747
= note: required because of the requirements on the impl of `Grault` for `(T,)`
4848

4949
error: aborting due to 3 previous errors

0 commit comments

Comments
 (0)