about summary refs log tree commit diff
path: root/compiler/rustc_parse/src/parser
diff options
context:
space:
mode:
authorMichael Goulet <michael@errs.io>2024-05-09 10:47:07 -0400
committerMichael Goulet <michael@errs.io>2024-05-09 10:47:14 -0400
commitdbdef68ddf0b8200954c81264400ef271a5f0194 (patch)
tree2702c14ef694397c3873af037e3b4ef1b3f53ce8 /compiler/rustc_parse/src/parser
parent6f7e00a3e6eade8350ce6280f05596236d73c4cb (diff)
downloadrust-dbdef68ddf0b8200954c81264400ef271a5f0194.tar.gz
rust-dbdef68ddf0b8200954c81264400ef271a5f0194.zip
Make sure we consume a generic arg when checking mistyped turbofish
Diffstat (limited to 'compiler/rustc_parse/src/parser')
-rw-r--r--compiler/rustc_parse/src/parser/diagnostics.rs6
1 files changed, 5 insertions, 1 deletions
diff --git a/compiler/rustc_parse/src/parser/diagnostics.rs b/compiler/rustc_parse/src/parser/diagnostics.rs
index f256dbf4360..ccf3b82ff7a 100644
--- a/compiler/rustc_parse/src/parser/diagnostics.rs
+++ b/compiler/rustc_parse/src/parser/diagnostics.rs
@@ -1224,7 +1224,11 @@ impl<'a> Parser<'a> {
             let x = self.parse_seq_to_before_end(
                 &token::Gt,
                 SeqSep::trailing_allowed(token::Comma),
-                |p| p.parse_generic_arg(None),
+                |p| match p.parse_generic_arg(None)? {
+                    Some(arg) => Ok(arg),
+                    // If we didn't eat a generic arg, then we should error.
+                    None => p.unexpected_any(),
+                },
             );
             match x {
                 Ok((_, _, Recovered::No)) => {