Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix typo in trait method mutability mismatch help #80930

Merged
merged 1 commit into from
Jan 12, 2021
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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