Skip to content

Commit b6dc03b

Browse files
committed
fix typo in trait method mutability mismatch help
1 parent c5eae56 commit b6dc03b

File tree

4 files changed

+13
-16
lines changed

4 files changed

+13
-16
lines changed

compiler/rustc_typeck/src/check/compare_method.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -296,7 +296,7 @@ fn compare_predicate_entailment<'tcx>(
296296
{
297297
diag.span_suggestion(
298298
impl_err_span,
299-
"consider change the type to match the mutability in trait",
299+
"consider changing the mutability to match the trait",
300300
trait_err_str,
301301
Applicability::MachineApplicable,
302302
);

src/test/ui/issues/issue-13033.stderr

+4-5
Original file line numberDiff line numberDiff line change
@@ -5,14 +5,13 @@ LL | fn bar(&mut self, other: &mut dyn Foo);
55
| ------------ type in trait
66
...
77
LL | fn bar(&mut self, other: &dyn Foo) {}
8-
| ^^^^^^^^ types differ in mutability
8+
| ^^^^^^^^
9+
| |
10+
| types differ in mutability
11+
| help: consider changing the mutability to match the trait: `&mut dyn Foo`
912
|
1013
= note: expected fn pointer `fn(&mut Baz, &mut dyn Foo)`
1114
found fn pointer `fn(&mut Baz, &dyn Foo)`
12-
help: consider change the type to match the mutability in trait
13-
|
14-
LL | fn bar(&mut self, other: &mut dyn Foo) {}
15-
| ^^^^^^^^^^^^
1615

1716
error: aborting due to previous error
1817

src/test/ui/mismatched_types/E0053.stderr

+4-5
Original file line numberDiff line numberDiff line change
@@ -17,14 +17,13 @@ LL | fn bar(&self);
1717
| ----- type in trait
1818
...
1919
LL | fn bar(&mut self) { }
20-
| ^^^^^^^^^ types differ in mutability
20+
| ^^^^^^^^^
21+
| |
22+
| types differ in mutability
23+
| help: consider changing the mutability to match the trait: `&self`
2124
|
2225
= note: expected fn pointer `fn(&Bar)`
2326
found fn pointer `fn(&mut Bar)`
24-
help: consider change the type to match the mutability in trait
25-
|
26-
LL | fn bar(&self) { }
27-
| ^^^^^
2827

2928
error: aborting due to 2 previous errors
3029

src/test/ui/mismatched_types/trait-impl-fn-incompatibility.stderr

+4-5
Original file line numberDiff line numberDiff line change
@@ -17,14 +17,13 @@ LL | fn bar(&mut self, bar: &mut Bar);
1717
| -------- type in trait
1818
...
1919
LL | fn bar(&mut self, bar: &Bar) { }
20-
| ^^^^ types differ in mutability
20+
| ^^^^
21+
| |
22+
| types differ in mutability
23+
| help: consider changing the mutability to match the trait: `&mut Bar`
2124
|
2225
= note: expected fn pointer `fn(&mut Bar, &mut Bar)`
2326
found fn pointer `fn(&mut Bar, &Bar)`
24-
help: consider change the type to match the mutability in trait
25-
|
26-
LL | fn bar(&mut self, bar: &mut Bar) { }
27-
| ^^^^^^^^
2827

2928
error: aborting due to 2 previous errors
3029

0 commit comments

Comments
 (0)