about summary refs log tree commit diff
path: root/compiler/rustc_hir_analysis/src
diff options
context:
space:
mode:
authorMichael Goulet <michael@errs.io>2023-01-04 00:26:53 +0000
committerMichael Goulet <michael@errs.io>2023-01-04 00:37:34 +0000
commit89086f7d36e3a692b48cae8a408057734f044567 (patch)
tree5beca76a7e235d72c3a87980fb15290120c3d306 /compiler/rustc_hir_analysis/src
parenta0390463fc27b627a86682722aaa11ff567212b8 (diff)
downloadrust-89086f7d36e3a692b48cae8a408057734f044567.tar.gz
rust-89086f7d36e3a692b48cae8a408057734f044567.zip
Restore Fn trait note
Diffstat (limited to 'compiler/rustc_hir_analysis/src')
-rw-r--r--compiler/rustc_hir_analysis/src/collect.rs6
1 files changed, 3 insertions, 3 deletions
diff --git a/compiler/rustc_hir_analysis/src/collect.rs b/compiler/rustc_hir_analysis/src/collect.rs
index 53a58df0916..cf847047c90 100644
--- a/compiler/rustc_hir_analysis/src/collect.rs
+++ b/compiler/rustc_hir_analysis/src/collect.rs
@@ -1231,10 +1231,10 @@ fn infer_return_ty_for_fn_sig<'tcx>(
                     Applicability::MachineApplicable,
                 );
             } else if ret_ty.is_closure() {
-                // We're dealing with a closure, so we should suggest using `impl Fn` or trait bounds
-                // to prevent the user from getting a papercut while trying to use the unique closure
-                // syntax (e.g. `[closure@src/lib.rs:2:5: 2:9]`).
                 diag.help("consider using an `Fn`, `FnMut`, or `FnOnce` trait bound");
+            }
+            // Also note how `Fn` traits work just in case!
+            if ret_ty.is_closure() {
                 diag.note(
                     "for more information on `Fn` traits and closure types, see \
                      https://doc.rust-lang.org/book/ch13-01-closures.html",