Fix typo in hir lowering lint diag

This commit is contained in:
Yotam Ofek 2025-03-14 20:19:38 +00:00
parent ecade534c6
commit 5da1ba41b3
8 changed files with 15 additions and 13 deletions

View File

@ -411,7 +411,9 @@ impl<'tcx> dyn HirTyLowerer<'tcx> + '_ {
Applicability::MachineApplicable,
);
if !is_dyn_compatible {
diag.note(format!("`{trait_name}` it is dyn-incompatible, so it can't be `dyn`"));
diag.note(format!(
"`{trait_name}` is dyn-incompatible, otherwise a trait object could be used"
));
} else {
// No ampersand in suggestion if it's borrowed already
let (dyn_str, paren_dyn_str) =

View File

@ -4,7 +4,7 @@ error[E0782]: expected a type, found a trait
LL | fn id<F>(f: Copy) -> usize {
| ^^^^
|
= note: `Copy` it is dyn-incompatible, so it can't be `dyn`
= note: `Copy` is dyn-incompatible, otherwise a trait object could be used
help: use a new generic type parameter, constrained by `Copy`
|
LL - fn id<F>(f: Copy) -> usize {

View File

@ -4,7 +4,7 @@ error[E0782]: expected a type, found a trait
LL | trait A { fn g(b: B) -> B; }
| ^
|
= note: `B` it is dyn-incompatible, so it can't be `dyn`
= note: `B` is dyn-incompatible, otherwise a trait object could be used
help: use a new generic type parameter, constrained by `B`
|
LL - trait A { fn g(b: B) -> B; }
@ -32,7 +32,7 @@ error[E0782]: expected a type, found a trait
LL | trait B { fn f(a: A) -> A; }
| ^
|
= note: `A` it is dyn-incompatible, so it can't be `dyn`
= note: `A` is dyn-incompatible, otherwise a trait object could be used
help: use a new generic type parameter, constrained by `A`
|
LL - trait B { fn f(a: A) -> A; }

View File

@ -4,7 +4,7 @@ error[E0782]: expected a type, found a trait
LL | fn concrete(b: B) -> B;
| ^
|
= note: `B` it is dyn-incompatible, so it can't be `dyn`
= note: `B` is dyn-incompatible, otherwise a trait object could be used
help: use a new generic type parameter, constrained by `B`
|
LL - fn concrete(b: B) -> B;
@ -32,7 +32,7 @@ error[E0782]: expected a type, found a trait
LL | fn f(a: A) -> A;
| ^
|
= note: `A` it is dyn-incompatible, so it can't be `dyn`
= note: `A` is dyn-incompatible, otherwise a trait object could be used
help: use a new generic type parameter, constrained by `A`
|
LL - fn f(a: A) -> A;

View File

@ -4,7 +4,7 @@ error[E0782]: expected a type, found a trait
LL | fn g(new: B) -> B;
| ^
|
= note: `B` it is dyn-incompatible, so it can't be `dyn`
= note: `B` is dyn-incompatible, otherwise a trait object could be used
help: use a new generic type parameter, constrained by `B`
|
LL - fn g(new: B) -> B;

View File

@ -4,7 +4,7 @@ error[E0782]: expected a type, found a trait
LL | fn guard(_s: Copy) -> bool {
| ^^^^
|
= note: `Copy` it is dyn-incompatible, so it can't be `dyn`
= note: `Copy` is dyn-incompatible, otherwise a trait object could be used
help: use a new generic type parameter, constrained by `Copy`
|
LL - fn guard(_s: Copy) -> bool {

View File

@ -4,7 +4,7 @@ error[E0782]: expected a type, found a trait
LL | fn g(b: B) -> B;
| ^
|
= note: `B` it is dyn-incompatible, so it can't be `dyn`
= note: `B` is dyn-incompatible, otherwise a trait object could be used
help: use a new generic type parameter, constrained by `B`
|
LL - fn g(b: B) -> B;
@ -32,7 +32,7 @@ error[E0782]: expected a type, found a trait
LL | fn f(a: A) -> A;
| ^
|
= note: `A` it is dyn-incompatible, so it can't be `dyn`
= note: `A` is dyn-incompatible, otherwise a trait object could be used
help: use a new generic type parameter, constrained by `A`
|
LL - fn f(a: A) -> A;

View File

@ -4,7 +4,7 @@ error[E0782]: expected a type, found a trait
LL | fn f(a: A) -> A;
| ^
|
= note: `A` it is dyn-incompatible, so it can't be `dyn`
= note: `A` is dyn-incompatible, otherwise a trait object could be used
help: use a new generic type parameter, constrained by `A`
|
LL - fn f(a: A) -> A;
@ -32,7 +32,7 @@ error[E0782]: expected a type, found a trait
LL | fn f(b: B) -> B;
| ^
|
= note: `B` it is dyn-incompatible, so it can't be `dyn`
= note: `B` is dyn-incompatible, otherwise a trait object could be used
help: use a new generic type parameter, constrained by `B`
|
LL - fn f(b: B) -> B;
@ -60,7 +60,7 @@ error[E0782]: expected a type, found a trait
LL | fn f(&self, c: C) -> C;
| ^
|
= note: `C` it is dyn-incompatible, so it can't be `dyn`
= note: `C` is dyn-incompatible, otherwise a trait object could be used
help: use a new generic type parameter, constrained by `C`
|
LL - fn f(&self, c: C) -> C;