about summary refs log tree commit diff
diff options
context:
space:
mode:
authorYuki Okushi <huyuumi.dev@gmail.com>2021-01-12 16:13:35 +0900
committerGitHub <noreply@github.com>2021-01-12 16:13:35 +0900
commit139daf564e47eae5c44445e959122ea5f80bb128 (patch)
tree9e12ec07277528439cff56d864162a6890237aae
parent8c342da22eb7cec90b673ea5fc305bca0b8afe13 (diff)
parentb6dc03b93dfe421a42d8dec910775a601fbd3d50 (diff)
downloadrust-139daf564e47eae5c44445e959122ea5f80bb128.tar.gz
rust-139daf564e47eae5c44445e959122ea5f80bb128.zip
Rollup merge of #80930 - euclio:trait-method-mutability-help, r=estebank
fix typo in trait method mutability mismatch help
-rw-r--r--compiler/rustc_typeck/src/check/compare_method.rs2
-rw-r--r--src/test/ui/issues/issue-13033.stderr9
-rw-r--r--src/test/ui/mismatched_types/E0053.stderr9
-rw-r--r--src/test/ui/mismatched_types/trait-impl-fn-incompatibility.stderr9
4 files changed, 13 insertions, 16 deletions
diff --git a/compiler/rustc_typeck/src/check/compare_method.rs b/compiler/rustc_typeck/src/check/compare_method.rs
index bb324d0d8bc..320ded5334e 100644
--- a/compiler/rustc_typeck/src/check/compare_method.rs
+++ b/compiler/rustc_typeck/src/check/compare_method.rs
@@ -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,
                         );
diff --git a/src/test/ui/issues/issue-13033.stderr b/src/test/ui/issues/issue-13033.stderr
index a8473c8a524..57447fa48aa 100644
--- a/src/test/ui/issues/issue-13033.stderr
+++ b/src/test/ui/issues/issue-13033.stderr
@@ -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
 
diff --git a/src/test/ui/mismatched_types/E0053.stderr b/src/test/ui/mismatched_types/E0053.stderr
index fef83e6bbe2..e0a3ce922b9 100644
--- a/src/test/ui/mismatched_types/E0053.stderr
+++ b/src/test/ui/mismatched_types/E0053.stderr
@@ -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
 
diff --git a/src/test/ui/mismatched_types/trait-impl-fn-incompatibility.stderr b/src/test/ui/mismatched_types/trait-impl-fn-incompatibility.stderr
index 5735120f710..161843473b6 100644
--- a/src/test/ui/mismatched_types/trait-impl-fn-incompatibility.stderr
+++ b/src/test/ui/mismatched_types/trait-impl-fn-incompatibility.stderr
@@ -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