Skip to content

Commit

Permalink
Rollup merge of #80930 - euclio:trait-method-mutability-help, r=estebank
Browse files Browse the repository at this point in the history
fix typo in trait method mutability mismatch help
  • Loading branch information
JohnTitor authored Jan 12, 2021
2 parents 8c342da + b6dc03b commit 139daf5
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
Original file line number Diff line number Diff line change
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
Original file line number Diff line number Diff line change
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
Original file line number Diff line number Diff line change
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
Original file line number Diff line number Diff line change
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 139daf5

Please sign in to comment.