diff options
| author | Esteban Küber <esteban@kuber.com.ar> | 2024-12-07 22:18:51 +0000 |
|---|---|---|
| committer | Esteban Küber <esteban@kuber.com.ar> | 2024-12-07 22:18:51 +0000 |
| commit | 25ad0478cb0975f10db6db3abb28d54df8e07430 (patch) | |
| tree | 39536f01d8031a90b6d4a7c93967434d024a7834 | |
| parent | 6277fb0a3f56b0ecec5679b3b3520ba3d4614743 (diff) | |
| download | rust-25ad0478cb0975f10db6db3abb28d54df8e07430.tar.gz rust-25ad0478cb0975f10db6db3abb28d54df8e07430.zip | |
Tweak wording
6 files changed, 13 insertions, 13 deletions
diff --git a/compiler/rustc_middle/src/ty/diagnostics.rs b/compiler/rustc_middle/src/ty/diagnostics.rs index a88aea3fa8e..604f1da26c6 100644 --- a/compiler/rustc_middle/src/ty/diagnostics.rs +++ b/compiler/rustc_middle/src/ty/diagnostics.rs @@ -361,10 +361,10 @@ pub fn suggest_constraining_type_params<'a>( trait_names.dedup(); let n = trait_names.len(); let stable = if all_stable { "" } else { "unstable " }; - let trait_ = if all_known { "trait" } else { "" }; - format!("{stable}{trait_}{} {}", pluralize!(n), match &trait_names[..] { - [t] => t.to_string(), - [ts @ .., last] => format!("{} and {last}", ts.join(", ")), + let trait_ = if all_known { format!("trait{}", pluralize!(n)) } else { String::new() }; + format!("{stable}{trait_}{}", match &trait_names[..] { + [t] => format!(" {t}"), + [ts @ .., last] => format!(" {} and {last}", ts.join(", ")), [] => return false, },) } else { @@ -531,7 +531,7 @@ pub fn suggest_constraining_type_params<'a>( let (span, post, suggestion, msg) = suggestions.pop().unwrap(); let msg = match msg { SuggestChangingConstraintsMessage::RestrictBoundFurther => { - format!("consider further restricting this bound with {post}") + format!("consider further restricting this bound") } SuggestChangingConstraintsMessage::RestrictTypeFurther { ty } | SuggestChangingConstraintsMessage::RestrictType { ty } diff --git a/tests/ui/associated-types/hr-associated-type-projection-1.stderr b/tests/ui/associated-types/hr-associated-type-projection-1.stderr index c322d11925a..b871bb51ae3 100644 --- a/tests/ui/associated-types/hr-associated-type-projection-1.stderr +++ b/tests/ui/associated-types/hr-associated-type-projection-1.stderr @@ -16,7 +16,7 @@ LL | trait UnsafeCopy<'a, T: Copy> LL | where LL | for<'b> <Self as UnsafeCopy<'b, T>>::Item: std::ops::Deref<Target = T>, | ^^^^^^^^^^ required by this bound in `UnsafeCopy` -help: consider further restricting this bound with `<Target = T>` +help: consider further restricting this bound | LL | impl<T: Copy + std::ops::Deref<Target = T>> UnsafeCopy<'_, T> for T { | ++++++++++++ diff --git a/tests/ui/generic-associated-types/issue-68656-unsized-values.stderr b/tests/ui/generic-associated-types/issue-68656-unsized-values.stderr index 16bfe2ec933..ecb337bbceb 100644 --- a/tests/ui/generic-associated-types/issue-68656-unsized-values.stderr +++ b/tests/ui/generic-associated-types/issue-68656-unsized-values.stderr @@ -13,7 +13,7 @@ note: required by a bound in `UnsafeCopy::Item` | LL | type Item<'a>: std::ops::Deref<Target = T>; | ^^^^^^^^^^ required by this bound in `UnsafeCopy::Item` -help: consider further restricting this bound with `<Target = T>` +help: consider further restricting this bound | LL | impl<T: Copy + std::ops::Deref<Target = T>> UnsafeCopy<T> for T { | ++++++++++++ diff --git a/tests/ui/generic-associated-types/missing-bounds.stderr b/tests/ui/generic-associated-types/missing-bounds.stderr index c18cc3106f3..6e0700639e9 100644 --- a/tests/ui/generic-associated-types/missing-bounds.stderr +++ b/tests/ui/generic-associated-types/missing-bounds.stderr @@ -35,7 +35,7 @@ note: tuple struct defined here | LL | struct A<B>(B); | ^ -help: consider further restricting this bound with `<Output = B>` +help: consider further restricting this bound | LL | impl<B> Add for A<B> where B: Add<Output = B> { | ++++++++++++ @@ -58,7 +58,7 @@ note: tuple struct defined here | LL | struct C<B>(B); | ^ -help: consider further restricting this bound with `<Output = B>` +help: consider further restricting this bound | LL | impl<B: Add<Output = B>> Add for C<B> { | ++++++++++++ @@ -94,7 +94,7 @@ note: tuple struct defined here | LL | struct E<B>(B); | ^ -help: consider further restricting this bound with `<Output = B>` +help: consider further restricting this bound | LL | impl<B: Add<Output = B>> Add for E<B> where <B as Add>::Output = B { | ++++++++++++ diff --git a/tests/ui/suggestions/restrict-existing-type-bounds.stderr b/tests/ui/suggestions/restrict-existing-type-bounds.stderr index 45dab9bec5d..fe8338c18c2 100644 --- a/tests/ui/suggestions/restrict-existing-type-bounds.stderr +++ b/tests/ui/suggestions/restrict-existing-type-bounds.stderr @@ -20,7 +20,7 @@ LL | Ok(self) | this argument influences the type of `Ok` note: tuple variant defined here --> $SRC_DIR/core/src/result.rs:LL:COL -help: consider further restricting this bound with `<Output = T>` +help: consider further restricting this bound | LL | impl<T: TryAdd<Output = T>> TryAdd for Option<T> { | ++++++++++++ @@ -47,7 +47,7 @@ LL | Ok(self) | this argument influences the type of `Ok` note: tuple variant defined here --> $SRC_DIR/core/src/result.rs:LL:COL -help: consider further restricting this bound with `, Output = T` +help: consider further restricting this bound | LL | impl<T: TryAdd<Error = X, Output = T>> TryAdd for Other<T> { | ++++++++++++ diff --git a/tests/ui/trait-bounds/restrict-assoc-type-of-generic-bound.stderr b/tests/ui/trait-bounds/restrict-assoc-type-of-generic-bound.stderr index ddadee3ea43..7aa32557af2 100644 --- a/tests/ui/trait-bounds/restrict-assoc-type-of-generic-bound.stderr +++ b/tests/ui/trait-bounds/restrict-assoc-type-of-generic-bound.stderr @@ -11,7 +11,7 @@ LL | return a.bar(); = note: expected type parameter `B` found associated type `<A as MyTrait>::T` = note: the caller chooses a type for `B` which can be different from `<A as MyTrait>::T` -help: consider further restricting this bound with `<T = B>` +help: consider further restricting this bound | LL | pub fn foo<A: MyTrait<T = B>, B>(a: A) -> B { | +++++++ |
