about summary refs log tree commit diff
path: root/crates/parser/src
diff options
context:
space:
mode:
authorshilangyu <xmarcinmarcin@gmail.com>2023-02-25 16:16:49 +0100
committershilangyu <xmarcinmarcin@gmail.com>2023-02-25 16:16:49 +0100
commit44e47fe4083adbd35889da7a6489ec3252a4f04b (patch)
tree82cd1eeaa269a027b8193517948fa66e2685ee2c /crates/parser/src
parent9a4efb4cc3f6516d27c246bdb414e99bb916b554 (diff)
downloadrust-44e47fe4083adbd35889da7a6489ec3252a4f04b.tar.gz
rust-44e47fe4083adbd35889da7a6489ec3252a4f04b.zip
Add check for extra path segments after an angled one
Diffstat (limited to 'crates/parser/src')
-rw-r--r--crates/parser/src/grammar/paths.rs6
1 files changed, 6 insertions, 0 deletions
diff --git a/crates/parser/src/grammar/paths.rs b/crates/parser/src/grammar/paths.rs
index 1064ae9970c..26490aa97e0 100644
--- a/crates/parser/src/grammar/paths.rs
+++ b/crates/parser/src/grammar/paths.rs
@@ -77,6 +77,9 @@ fn path_segment(p: &mut Parser<'_>, mode: Mode, first: bool) {
     // type X = <A as B>::Output;
     // fn foo() { <usize as Default>::default(); }
     if first && p.eat(T![<]) {
+        // test_err angled_path_without_qual
+        // type X = <()>;
+        // type Y = <A as B>;
         types::type_(p);
         if p.eat(T![as]) {
             if is_use_path_start(p) {
@@ -86,6 +89,9 @@ fn path_segment(p: &mut Parser<'_>, mode: Mode, first: bool) {
             }
         }
         p.expect(T![>]);
+        if !p.at(T![::]) {
+            p.error("expected `::`");
+        }
     } else {
         let empty = if first {
             p.eat(T![::]);