]> git.lizzy.rs Git - rust.git/commitdiff
Fix missing parentheses Fn notation error
authorArthur Woimbée <arthur.woimbee@gmail.com>
Wed, 27 May 2020 16:31:22 +0000 (18:31 +0200)
committerArthur Woimbée <arthur.woimbee@gmail.com>
Sat, 30 May 2020 16:40:41 +0000 (18:40 +0200)
src/librustc_typeck/astconv.rs

index 12edfed19c07e409606ec7c507d02cdedd41f487..ab9db159038af09b5187dbe897006a5ef8d660a0 100644 (file)
@@ -1151,9 +1151,16 @@ fn complain_about_internal_fn_trait(
                             .as_ref()
                             .and_then(|args| args.args.get(0))
                             .and_then(|arg| match arg {
-                                hir::GenericArg::Type(ty) => {
-                                    sess.source_map().span_to_snippet(ty.span).ok()
+                                hir::GenericArg::Type(ty) => match ty.kind {
+                                    hir::TyKind::Tup(t) => t
+                                        .iter()
+                                        .map(|e| sess.source_map().span_to_snippet(e.span))
+                                        .collect::<Result<Vec<_>, _>>()
+                                        .map(|a| a.join(", ")),
+                                    _ => sess.source_map().span_to_snippet(ty.span),
                                 }
+                                .map(|s| format!("({})", s))
+                                .ok(),
                                 _ => None,
                             })
                             .unwrap_or_else(|| "()".to_string()),