Skip to content

Commit

Permalink
fix typo in trait method mutability mismatch help
Browse files Browse the repository at this point in the history
  • Loading branch information
euclio committed Jan 12, 2021
1 parent c5eae56 commit b6dc03b
Show file tree
Hide file tree
Showing 4 changed files with 13 additions and 16 deletions.
2 changes: 1 addition & 1 deletion compiler/rustc_typeck/src/check/compare_method.rs
Expand Up @@ -296,7 +296,7 @@ fn compare_predicate_entailment<'tcx>(
{
diag.span_suggestion(
impl_err_span,
"consider change the type to match the mutability in trait",
"consider changing the mutability to match the trait",
trait_err_str,
Applicability::MachineApplicable,
);
Expand Down
9 changes: 4 additions & 5 deletions src/test/ui/issues/issue-13033.stderr
Expand Up @@ -5,14 +5,13 @@ LL | fn bar(&mut self, other: &mut dyn Foo);
| ------------ type in trait
...
LL | fn bar(&mut self, other: &dyn Foo) {}
| ^^^^^^^^ types differ in mutability
| ^^^^^^^^
| |
| types differ in mutability
| help: consider changing the mutability to match the trait: `&mut dyn Foo`
|
= note: expected fn pointer `fn(&mut Baz, &mut dyn Foo)`
found fn pointer `fn(&mut Baz, &dyn Foo)`
help: consider change the type to match the mutability in trait
|
LL | fn bar(&mut self, other: &mut dyn Foo) {}
| ^^^^^^^^^^^^

error: aborting due to previous error

Expand Down
9 changes: 4 additions & 5 deletions src/test/ui/mismatched_types/E0053.stderr
Expand Up @@ -17,14 +17,13 @@ LL | fn bar(&self);
| ----- type in trait
...
LL | fn bar(&mut self) { }
| ^^^^^^^^^ types differ in mutability
| ^^^^^^^^^
| |
| types differ in mutability
| help: consider changing the mutability to match the trait: `&self`
|
= note: expected fn pointer `fn(&Bar)`
found fn pointer `fn(&mut Bar)`
help: consider change the type to match the mutability in trait
|
LL | fn bar(&self) { }
| ^^^^^

error: aborting due to 2 previous errors

Expand Down
Expand Up @@ -17,14 +17,13 @@ LL | fn bar(&mut self, bar: &mut Bar);
| -------- type in trait
...
LL | fn bar(&mut self, bar: &Bar) { }
| ^^^^ types differ in mutability
| ^^^^
| |
| types differ in mutability
| help: consider changing the mutability to match the trait: `&mut Bar`
|
= note: expected fn pointer `fn(&mut Bar, &mut Bar)`
found fn pointer `fn(&mut Bar, &Bar)`
help: consider change the type to match the mutability in trait
|
LL | fn bar(&mut self, bar: &mut Bar) { }
| ^^^^^^^^

error: aborting due to 2 previous errors

Expand Down

0 comments on commit b6dc03b

Please sign in to comment.