mirror of
https://github.com/rust-lang/rust-analyzer.git
synced 2025-10-28 10:39:45 +00:00
feat: complete raw, const keyword
This commit is contained in:
parent
7d337c7f35
commit
9809143562
6 changed files with 144 additions and 8 deletions
|
|
@ -339,13 +339,20 @@ fn lhs(p: &mut Parser<'_>, r: Restrictions) -> Option<(CompletedMarker, BlockLik
|
|||
// // raw reference operator
|
||||
// let _ = &raw mut foo;
|
||||
// let _ = &raw const foo;
|
||||
// let _ = &raw foo;
|
||||
// }
|
||||
T![&] => {
|
||||
m = p.start();
|
||||
p.bump(T![&]);
|
||||
if p.at_contextual_kw(T![raw]) && [T![mut], T![const]].contains(&p.nth(1)) {
|
||||
p.bump_remap(T![raw]);
|
||||
p.bump_any();
|
||||
if p.at_contextual_kw(T![raw]) {
|
||||
if [T![mut], T![const]].contains(&p.nth(1)) {
|
||||
p.bump_remap(T![raw]);
|
||||
p.bump_any();
|
||||
} else if p.nth_at(1, SyntaxKind::IDENT) {
|
||||
// we treat raw as keyword in this case
|
||||
// &raw foo;
|
||||
p.bump_remap(T![raw]);
|
||||
}
|
||||
} else {
|
||||
p.eat(T![mut]);
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue