From 25ad0478cb0975f10db6db3abb28d54df8e07430 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Esteban=20K=C3=BCber?= Date: Sat, 7 Dec 2024 22:18:51 +0000 Subject: [PATCH] Tweak wording --- compiler/rustc_middle/src/ty/diagnostics.rs | 10 +++++----- .../hr-associated-type-projection-1.stderr | 2 +- .../issue-68656-unsized-values.stderr | 2 +- .../ui/generic-associated-types/missing-bounds.stderr | 6 +++--- .../suggestions/restrict-existing-type-bounds.stderr | 4 ++-- .../restrict-assoc-type-of-generic-bound.stderr | 2 +- 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 a88aea3fa8ee..604f1da26c64 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 c322d11925af..b871bb51ae31 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> >::Item: std::ops::Deref, | ^^^^^^^^^^ required by this bound in `UnsafeCopy` -help: consider further restricting this bound with `` +help: consider further restricting this bound | LL | impl> 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 16bfe2ec9337..ecb337bbceb9 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; | ^^^^^^^^^^ required by this bound in `UnsafeCopy::Item` -help: consider further restricting this bound with `` +help: consider further restricting this bound | LL | impl> UnsafeCopy for T { | ++++++++++++ diff --git a/tests/ui/generic-associated-types/missing-bounds.stderr b/tests/ui/generic-associated-types/missing-bounds.stderr index c18cc3106f35..6e0700639e9c 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); | ^ -help: consider further restricting this bound with `` +help: consider further restricting this bound | LL | impl Add for A where B: Add { | ++++++++++++ @@ -58,7 +58,7 @@ note: tuple struct defined here | LL | struct C(B); | ^ -help: consider further restricting this bound with `` +help: consider further restricting this bound | LL | impl> Add for C { | ++++++++++++ @@ -94,7 +94,7 @@ note: tuple struct defined here | LL | struct E(B); | ^ -help: consider further restricting this bound with `` +help: consider further restricting this bound | LL | impl> Add for E where ::Output = B { | ++++++++++++ diff --git a/tests/ui/suggestions/restrict-existing-type-bounds.stderr b/tests/ui/suggestions/restrict-existing-type-bounds.stderr index 45dab9bec5da..fe8338c18c2b 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 `` +help: consider further restricting this bound | LL | impl> TryAdd for Option { | ++++++++++++ @@ -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> TryAdd for Other { | ++++++++++++ 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 ddadee3ea43f..7aa32557af2d 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 `::T` = note: the caller chooses a type for `B` which can be different from `::T` -help: consider further restricting this bound with `` +help: consider further restricting this bound | LL | pub fn foo, B>(a: A) -> B { | +++++++