Skip to content

Commit ca4eb90

Browse files
committed
Simulate <> in existing code for perf
1 parent 255468e commit ca4eb90

File tree

1 file changed

+8
-0
lines changed

1 file changed

+8
-0
lines changed

src/libsyntax/parse/parser.rs

+8
Original file line numberDiff line numberDiff line change
@@ -2039,6 +2039,14 @@ impl<'a> Parser<'a> {
20392039
Ok(if style == PathStyle::Type && check_args_start(self, true)
20402040
|| style != PathStyle::Mod && self.check(&token::ModSep)
20412041
&& self.look_ahead(1, |t| is_args_start(t, true))
2042+
&& {
2043+
if style == PathStyle::Expr {
2044+
// Simulate every occurrence of `::<>` actually being `<>`.
2045+
self.eat(&token::ModSep);
2046+
parser_snapshot_before_generics = Some(self.clone());
2047+
}
2048+
true
2049+
}
20422050
|| style == PathStyle::Expr && check_args_start(self, false) && {
20432051
// Check for generic arguments in an expression without a disambiguating `::`.
20442052
// We have to save a snapshot, because it could end up being an expression

0 commit comments

Comments
 (0)