about summary refs log tree commit diff
diff options
context:
space:
mode:
authorArthur Woimbée <arthur.woimbee@gmail.com>2020-05-27 18:31:22 +0200
committerArthur Woimbée <arthur.woimbee@gmail.com>2020-05-30 18:40:41 +0200
commit5a813b6dd66d8056c62d268479c0b27dcd697554 (patch)
tree479d5932d9dd7cd912e846e0d1f4af6359bc328b
parent74e80468347471779be6060d8d7d6d04e98e467f (diff)
downloadrust-5a813b6dd66d8056c62d268479c0b27dcd697554.tar.gz
rust-5a813b6dd66d8056c62d268479c0b27dcd697554.zip
Fix missing parentheses Fn notation error
-rw-r--r--src/librustc_typeck/astconv.rs11
1 files changed, 9 insertions, 2 deletions
diff --git a/src/librustc_typeck/astconv.rs b/src/librustc_typeck/astconv.rs
index 12edfed19c0..ab9db159038 100644
--- a/src/librustc_typeck/astconv.rs
+++ b/src/librustc_typeck/astconv.rs
@@ -1151,9 +1151,16 @@ impl<'o, 'tcx> dyn AstConv<'tcx> + 'o {
                             .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()),