diff options
| author | Michael Goulet <michael@errs.io> | 2023-01-04 00:26:53 +0000 |
|---|---|---|
| committer | Michael Goulet <michael@errs.io> | 2023-01-04 00:37:34 +0000 |
| commit | 89086f7d36e3a692b48cae8a408057734f044567 (patch) | |
| tree | 5beca76a7e235d72c3a87980fb15290120c3d306 /compiler/rustc_hir_analysis/src | |
| parent | a0390463fc27b627a86682722aaa11ff567212b8 (diff) | |
| download | rust-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.rs | 6 |
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", |
