mirror of
https://github.com/rust-lang/rust-analyzer.git
synced 2025-10-02 06:41:48 +00:00
Fix is_path_start to accept T![<], fix is_path_start usages
This commit is contained in:
parent
f1e62501c3
commit
8222a1fddf
8 changed files with 17 additions and 13 deletions
|
@ -4,6 +4,10 @@ pub(super) const PATH_FIRST: TokenSet =
|
|||
token_set![IDENT, SELF_KW, SUPER_KW, CRATE_KW, COLONCOLON, L_ANGLE];
|
||||
|
||||
pub(super) fn is_path_start(p: &Parser) -> bool {
|
||||
is_use_path_start(p) || p.at(T![<])
|
||||
}
|
||||
|
||||
pub(super) fn is_use_path_start(p: &Parser) -> bool {
|
||||
match p.current() {
|
||||
IDENT | T![self] | T![super] | T![crate] | T![::] => true,
|
||||
_ => false,
|
||||
|
@ -58,7 +62,7 @@ fn path_segment(p: &mut Parser, mode: Mode, first: bool) {
|
|||
if first && p.eat(T![<]) {
|
||||
types::type_(p);
|
||||
if p.eat(T![as]) {
|
||||
if is_path_start(p) {
|
||||
if is_use_path_start(p) {
|
||||
types::path_type(p);
|
||||
} else {
|
||||
p.error("expected a trait");
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue