about summary refs log tree commit diff
path: root/compiler
diff options
context:
space:
mode:
authorStuart Cook <Zalathar@users.noreply.github.com>2025-09-01 12:42:27 +1000
committerGitHub <noreply@github.com>2025-09-01 12:42:27 +1000
commiteed52596abf7cbe2af47b18da52ae0567640bc51 (patch)
tree62d46a6f183ad0b29e685a1af6480532e76e2575 /compiler
parent142ad696982564bbac63594531df0a4983e09218 (diff)
parent263766bcc28a9441d0acfb1a335308e46cfd1917 (diff)
downloadrust-eed52596abf7cbe2af47b18da52ae0567640bc51.tar.gz
rust-eed52596abf7cbe2af47b18da52ae0567640bc51.zip
Rollup merge of #146046 - chenyukang:yukang-fix-method-exists-for-ret-ty-error, r=estebank
Suggest method name with maybe ty mismatch

Fixes rust-lang/rust#146008

I think it's ok to suggest method name even when the return ty mismatch, since we only reporting in `Applicability::MaybeIncorrect`, user may add `()` and continue to fix following errors.

r? ```@estebank```
Diffstat (limited to 'compiler')
-rw-r--r--compiler/rustc_hir_typeck/src/method/mod.rs2
1 files changed, 1 insertions, 1 deletions
diff --git a/compiler/rustc_hir_typeck/src/method/mod.rs b/compiler/rustc_hir_typeck/src/method/mod.rs
index e37ea031672..652644ad78c 100644
--- a/compiler/rustc_hir_typeck/src/method/mod.rs
+++ b/compiler/rustc_hir_typeck/src/method/mod.rs
@@ -117,7 +117,7 @@ impl<'a, 'tcx> FnCtxt<'a, 'tcx> {
             Err(Ambiguity(..)) => true,
             Err(PrivateMatch(..)) => false,
             Err(IllegalSizedBound { .. }) => true,
-            Err(BadReturnType) => false,
+            Err(BadReturnType) => true,
             Err(ErrorReported(_)) => false,
         }
     }