From b6dc03b93dfe421a42d8dec910775a601fbd3d50 Mon Sep 17 00:00:00 2001 From: Andy Russell Date: Mon, 11 Jan 2021 19:27:38 -0500 Subject: [PATCH] fix typo in trait method mutability mismatch help --- compiler/rustc_typeck/src/check/compare_method.rs | 2 +- src/test/ui/issues/issue-13033.stderr | 9 ++++----- src/test/ui/mismatched_types/E0053.stderr | 9 ++++----- .../trait-impl-fn-incompatibility.stderr | 9 ++++----- 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 bb324d0d8bc1e..320ded5334e21 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 a8473c8a52413..57447fa48aacc 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 fef83e6bbe2b6..e0a3ce922b970 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 5735120f7104a..161843473b6c1 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