]> git.lizzy.rs Git - rust.git/commitdiff
fix typo in trait method mutability mismatch help
authorAndy Russell <arussell123@gmail.com>
Tue, 12 Jan 2021 00:27:38 +0000 (19:27 -0500)
committerAndy Russell <arussell123@gmail.com>
Tue, 12 Jan 2021 00:28:25 +0000 (19:28 -0500)
compiler/rustc_typeck/src/check/compare_method.rs
src/test/ui/issues/issue-13033.stderr
src/test/ui/mismatched_types/E0053.stderr
src/test/ui/mismatched_types/trait-impl-fn-incompatibility.stderr

index bb324d0d8bc1ee27aaf0a8df2da6c4d575ecd21d..320ded5334e2164d64b6a8395e259fec4589fdce 100644 (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,
                         );
index a8473c8a5241327d8e05636cec816261c4ce6e6e..57447fa48aacc596a83a01dcd316f124cd031d88 100644 (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
 
index fef83e6bbe2b6acd19408ba1bbe1317cee04ba4d..e0a3ce922b97023ad510616c7a68abb3031189a0 100644 (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
 
index 5735120f7104a189e029b2f2bc184d0683a1386d..161843473b6c10f02286d5f6eae9c577a0ec3dd2 100644 (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