about summary refs log tree commit diff
path: root/compiler/rustc_parse/src/parser
diff options
context:
space:
mode:
authorbors <bors@rust-lang.org>2021-01-13 20:35:58 +0000
committerbors <bors@rust-lang.org>2021-01-13 20:35:58 +0000
commita62a76047ea24aad7639f14eb3ce0e620b77bdb7 (patch)
treea3a7fb0140d8cc55261f719e566e7221b1d3c41b /compiler/rustc_parse/src/parser
parent9bc8b00b4a4e38ccbc3aeec2c123538973c67eba (diff)
parentd2f8e398f19b5b3d38646328ec158f50db6b8b06 (diff)
downloadrust-a62a76047ea24aad7639f14eb3ce0e620b77bdb7.tar.gz
rust-a62a76047ea24aad7639f14eb3ce0e620b77bdb7.zip
Auto merge of #77524 - Patryk27:fixes/66228, r=estebank
Rework diagnostics for wrong number of generic args (fixes #66228 and #71924)

This PR reworks the `wrong number of {} arguments` message, so that it provides more details and contextual hints.
Diffstat (limited to 'compiler/rustc_parse/src/parser')
-rw-r--r--compiler/rustc_parse/src/parser/path.rs3
1 files changed, 2 insertions, 1 deletions
diff --git a/compiler/rustc_parse/src/parser/path.rs b/compiler/rustc_parse/src/parser/path.rs
index 43dee391c17..dd36122f6a1 100644
--- a/compiler/rustc_parse/src/parser/path.rs
+++ b/compiler/rustc_parse/src/parser/path.rs
@@ -230,10 +230,11 @@ impl<'a> Parser<'a> {
                 } else {
                     // `(T, U) -> R`
                     let (inputs, _) = self.parse_paren_comma_seq(|p| p.parse_ty())?;
+                    let inputs_span = lo.to(self.prev_token.span);
                     let span = ident.span.to(self.prev_token.span);
                     let output =
                         self.parse_ret_ty(AllowPlus::No, RecoverQPath::No, RecoverReturnSign::No)?;
-                    ParenthesizedArgs { inputs, output, span }.into()
+                    ParenthesizedArgs { span, inputs, inputs_span, output }.into()
                 };
 
                 PathSegment { ident, args, id: ast::DUMMY_NODE_ID }