Skip to content

Commit 25ad047

Browse files
committed
Tweak wording
1 parent 6277fb0 commit 25ad047

File tree

6 files changed

+13
-13
lines changed

6 files changed

+13
-13
lines changed

compiler/rustc_middle/src/ty/diagnostics.rs

+5-5
Original file line numberDiff line numberDiff line change
@@ -361,10 +361,10 @@ pub fn suggest_constraining_type_params<'a>(
361361
trait_names.dedup();
362362
let n = trait_names.len();
363363
let stable = if all_stable { "" } else { "unstable " };
364-
let trait_ = if all_known { "trait" } else { "" };
365-
format!("{stable}{trait_}{} {}", pluralize!(n), match &trait_names[..] {
366-
[t] => t.to_string(),
367-
[ts @ .., last] => format!("{} and {last}", ts.join(", ")),
364+
let trait_ = if all_known { format!("trait{}", pluralize!(n)) } else { String::new() };
365+
format!("{stable}{trait_}{}", match &trait_names[..] {
366+
[t] => format!(" {t}"),
367+
[ts @ .., last] => format!(" {} and {last}", ts.join(", ")),
368368
[] => return false,
369369
},)
370370
} else {
@@ -531,7 +531,7 @@ pub fn suggest_constraining_type_params<'a>(
531531
let (span, post, suggestion, msg) = suggestions.pop().unwrap();
532532
let msg = match msg {
533533
SuggestChangingConstraintsMessage::RestrictBoundFurther => {
534-
format!("consider further restricting this bound with {post}")
534+
format!("consider further restricting this bound")
535535
}
536536
SuggestChangingConstraintsMessage::RestrictTypeFurther { ty }
537537
| SuggestChangingConstraintsMessage::RestrictType { ty }

tests/ui/associated-types/hr-associated-type-projection-1.stderr

+1-1
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@ LL | trait UnsafeCopy<'a, T: Copy>
1616
LL | where
1717
LL | for<'b> <Self as UnsafeCopy<'b, T>>::Item: std::ops::Deref<Target = T>,
1818
| ^^^^^^^^^^ required by this bound in `UnsafeCopy`
19-
help: consider further restricting this bound with `<Target = T>`
19+
help: consider further restricting this bound
2020
|
2121
LL | impl<T: Copy + std::ops::Deref<Target = T>> UnsafeCopy<'_, T> for T {
2222
| ++++++++++++

tests/ui/generic-associated-types/issue-68656-unsized-values.stderr

+1-1
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@ note: required by a bound in `UnsafeCopy::Item`
1313
|
1414
LL | type Item<'a>: std::ops::Deref<Target = T>;
1515
| ^^^^^^^^^^ required by this bound in `UnsafeCopy::Item`
16-
help: consider further restricting this bound with `<Target = T>`
16+
help: consider further restricting this bound
1717
|
1818
LL | impl<T: Copy + std::ops::Deref<Target = T>> UnsafeCopy<T> for T {
1919
| ++++++++++++

tests/ui/generic-associated-types/missing-bounds.stderr

+3-3
Original file line numberDiff line numberDiff line change
@@ -35,7 +35,7 @@ note: tuple struct defined here
3535
|
3636
LL | struct A<B>(B);
3737
| ^
38-
help: consider further restricting this bound with `<Output = B>`
38+
help: consider further restricting this bound
3939
|
4040
LL | impl<B> Add for A<B> where B: Add<Output = B> {
4141
| ++++++++++++
@@ -58,7 +58,7 @@ note: tuple struct defined here
5858
|
5959
LL | struct C<B>(B);
6060
| ^
61-
help: consider further restricting this bound with `<Output = B>`
61+
help: consider further restricting this bound
6262
|
6363
LL | impl<B: Add<Output = B>> Add for C<B> {
6464
| ++++++++++++
@@ -94,7 +94,7 @@ note: tuple struct defined here
9494
|
9595
LL | struct E<B>(B);
9696
| ^
97-
help: consider further restricting this bound with `<Output = B>`
97+
help: consider further restricting this bound
9898
|
9999
LL | impl<B: Add<Output = B>> Add for E<B> where <B as Add>::Output = B {
100100
| ++++++++++++

tests/ui/suggestions/restrict-existing-type-bounds.stderr

+2-2
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,7 @@ LL | Ok(self)
2020
| this argument influences the type of `Ok`
2121
note: tuple variant defined here
2222
--> $SRC_DIR/core/src/result.rs:LL:COL
23-
help: consider further restricting this bound with `<Output = T>`
23+
help: consider further restricting this bound
2424
|
2525
LL | impl<T: TryAdd<Output = T>> TryAdd for Option<T> {
2626
| ++++++++++++
@@ -47,7 +47,7 @@ LL | Ok(self)
4747
| this argument influences the type of `Ok`
4848
note: tuple variant defined here
4949
--> $SRC_DIR/core/src/result.rs:LL:COL
50-
help: consider further restricting this bound with `, Output = T`
50+
help: consider further restricting this bound
5151
|
5252
LL | impl<T: TryAdd<Error = X, Output = T>> TryAdd for Other<T> {
5353
| ++++++++++++

tests/ui/trait-bounds/restrict-assoc-type-of-generic-bound.stderr

+1-1
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@ LL | return a.bar();
1111
= note: expected type parameter `B`
1212
found associated type `<A as MyTrait>::T`
1313
= note: the caller chooses a type for `B` which can be different from `<A as MyTrait>::T`
14-
help: consider further restricting this bound with `<T = B>`
14+
help: consider further restricting this bound
1515
|
1616
LL | pub fn foo<A: MyTrait<T = B>, B>(a: A) -> B {
1717
| +++++++

0 commit comments

Comments
 (0)