Rollup merge of #80930 - euclio:trait-method-mutability-help, r=estebank

fix typo in trait method mutability mismatch help
This commit is contained in:
Yuki Okushi 2021-01-12 16:13:35 +09:00 committed by GitHub
commit 139daf564e
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
4 changed files with 13 additions and 16 deletions

View File

@ -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,
);

View File

@ -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

View File

@ -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

View File

@ -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