mirror of
https://github.com/rust-lang/rust-analyzer.git
synced 2025-10-30 03:27:44 +00:00
Give path segment type anchors their own grammar rule
This commit is contained in:
parent
d2164fe08b
commit
7c3de05e3a
14 changed files with 223 additions and 158 deletions
|
|
@ -89,7 +89,9 @@ fn path_segment(p: &mut Parser<'_>, mode: Mode, first: bool) -> Option<Completed
|
|||
// test qual_paths
|
||||
// type X = <A as B>::Output;
|
||||
// fn foo() { <usize as Default>::default(); }
|
||||
if first && p.eat(T![<]) {
|
||||
if first && p.at(T![<]) {
|
||||
let m = p.start();
|
||||
p.bump(T![<]);
|
||||
// test_err angled_path_without_qual
|
||||
// type X = <()>;
|
||||
// type Y = <A as B>;
|
||||
|
|
@ -102,6 +104,7 @@ fn path_segment(p: &mut Parser<'_>, mode: Mode, first: bool) -> Option<Completed
|
|||
}
|
||||
}
|
||||
p.expect(T![>]);
|
||||
m.complete(p, TYPE_ANCHOR);
|
||||
if !p.at(T![::]) {
|
||||
p.error("expected `::`");
|
||||
}
|
||||
|
|
|
|||
|
|
@ -291,6 +291,7 @@ pub enum SyntaxKind {
|
|||
TUPLE_STRUCT_PAT,
|
||||
TUPLE_TYPE,
|
||||
TYPE_ALIAS,
|
||||
TYPE_ANCHOR,
|
||||
TYPE_ARG,
|
||||
TYPE_BOUND,
|
||||
TYPE_BOUND_LIST,
|
||||
|
|
@ -463,6 +464,7 @@ impl SyntaxKind {
|
|||
| TUPLE_STRUCT_PAT
|
||||
| TUPLE_TYPE
|
||||
| TYPE_ALIAS
|
||||
| TYPE_ANCHOR
|
||||
| TYPE_ARG
|
||||
| TYPE_BOUND
|
||||
| TYPE_BOUND_LIST
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue