Skip to content

Commit 5da1ba4

Browse files
committed
Fix typo in hir lowering lint diag
1 parent ecade53 commit 5da1ba4

8 files changed

+15
-13
lines changed

compiler/rustc_hir_analysis/src/hir_ty_lowering/lint.rs

+3-1
Original file line numberDiff line numberDiff line change
@@ -411,7 +411,9 @@ impl<'tcx> dyn HirTyLowerer<'tcx> + '_ {
411411
Applicability::MachineApplicable,
412412
);
413413
if !is_dyn_compatible {
414-
diag.note(format!("`{trait_name}` it is dyn-incompatible, so it can't be `dyn`"));
414+
diag.note(format!(
415+
"`{trait_name}` is dyn-incompatible, otherwise a trait object could be used"
416+
));
415417
} else {
416418
// No ampersand in suggestion if it's borrowed already
417419
let (dyn_str, paren_dyn_str) =

tests/ui/dyn-compatibility/avoid-ice-on-warning-2.new.stderr

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

tests/ui/dyn-compatibility/avoid-ice-on-warning-3.new.stderr

+2-2
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@ error[E0782]: expected a type, found a trait
44
LL | trait A { fn g(b: B) -> B; }
55
| ^
66
|
7-
= note: `B` it is dyn-incompatible, so it can't be `dyn`
7+
= note: `B` is dyn-incompatible, otherwise a trait object could be used
88
help: use a new generic type parameter, constrained by `B`
99
|
1010
LL - trait A { fn g(b: B) -> B; }
@@ -32,7 +32,7 @@ error[E0782]: expected a type, found a trait
3232
LL | trait B { fn f(a: A) -> A; }
3333
| ^
3434
|
35-
= note: `A` it is dyn-incompatible, so it can't be `dyn`
35+
= note: `A` is dyn-incompatible, otherwise a trait object could be used
3636
help: use a new generic type parameter, constrained by `A`
3737
|
3838
LL - trait B { fn f(a: A) -> A; }

tests/ui/rust-2021/ice-return-unsized-can-impl-2.stderr

+2-2
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@ error[E0782]: expected a type, found a trait
44
LL | fn concrete(b: B) -> B;
55
| ^
66
|
7-
= note: `B` it is dyn-incompatible, so it can't be `dyn`
7+
= note: `B` is dyn-incompatible, otherwise a trait object could be used
88
help: use a new generic type parameter, constrained by `B`
99
|
1010
LL - fn concrete(b: B) -> B;
@@ -32,7 +32,7 @@ error[E0782]: expected a type, found a trait
3232
LL | fn f(a: A) -> A;
3333
| ^
3434
|
35-
= note: `A` it is dyn-incompatible, so it can't be `dyn`
35+
= note: `A` is dyn-incompatible, otherwise a trait object could be used
3636
help: use a new generic type parameter, constrained by `A`
3737
|
3838
LL - fn f(a: A) -> A;

tests/ui/rust-2021/ice-return-unsized-can-impl.stderr

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

tests/ui/rust-2021/ice-unsized-fn-params-2.stderr

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

tests/ui/rust-2021/ice-unsized-fn-params.stderr

+2-2
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@ error[E0782]: expected a type, found a trait
44
LL | fn g(b: B) -> B;
55
| ^
66
|
7-
= note: `B` it is dyn-incompatible, so it can't be `dyn`
7+
= note: `B` is dyn-incompatible, otherwise a trait object could be used
88
help: use a new generic type parameter, constrained by `B`
99
|
1010
LL - fn g(b: B) -> B;
@@ -32,7 +32,7 @@ error[E0782]: expected a type, found a trait
3232
LL | fn f(a: A) -> A;
3333
| ^
3434
|
35-
= note: `A` it is dyn-incompatible, so it can't be `dyn`
35+
= note: `A` is dyn-incompatible, otherwise a trait object could be used
3636
help: use a new generic type parameter, constrained by `A`
3737
|
3838
LL - fn f(a: A) -> A;

tests/ui/suggestions/dyn-incompatible-trait-should-use-self-2021-without-dyn.stderr

+3-3
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@ error[E0782]: expected a type, found a trait
44
LL | fn f(a: A) -> A;
55
| ^
66
|
7-
= note: `A` it is dyn-incompatible, so it can't be `dyn`
7+
= note: `A` is dyn-incompatible, otherwise a trait object could be used
88
help: use a new generic type parameter, constrained by `A`
99
|
1010
LL - fn f(a: A) -> A;
@@ -32,7 +32,7 @@ error[E0782]: expected a type, found a trait
3232
LL | fn f(b: B) -> B;
3333
| ^
3434
|
35-
= note: `B` it is dyn-incompatible, so it can't be `dyn`
35+
= note: `B` is dyn-incompatible, otherwise a trait object could be used
3636
help: use a new generic type parameter, constrained by `B`
3737
|
3838
LL - fn f(b: B) -> B;
@@ -60,7 +60,7 @@ error[E0782]: expected a type, found a trait
6060
LL | fn f(&self, c: C) -> C;
6161
| ^
6262
|
63-
= note: `C` it is dyn-incompatible, so it can't be `dyn`
63+
= note: `C` is dyn-incompatible, otherwise a trait object could be used
6464
help: use a new generic type parameter, constrained by `C`
6565
|
6666
LL - fn f(&self, c: C) -> C;

0 commit comments

Comments
 (0)