mirror of
https://github.com/rust-lang/rust-analyzer.git
synced 2025-09-28 12:54:58 +00:00
Support raw_ref_op's raw reference operator
This commit is contained in:
parent
190a0595a4
commit
367487fe88
12 changed files with 259 additions and 72 deletions
|
@ -325,13 +325,27 @@ fn lhs(p: &mut Parser, r: Restrictions) -> Option<(CompletedMarker, BlockLike)>
|
|||
let kind = match p.current() {
|
||||
// test ref_expr
|
||||
// fn foo() {
|
||||
// // reference operator
|
||||
// let _ = &1;
|
||||
// let _ = &mut &f();
|
||||
// let _ = &raw;
|
||||
// let _ = &raw.0;
|
||||
// // raw reference operator
|
||||
// let _ = &raw mut foo;
|
||||
// let _ = &raw const foo;
|
||||
// }
|
||||
T![&] => {
|
||||
m = p.start();
|
||||
p.bump(T![&]);
|
||||
p.eat(T![mut]);
|
||||
if p.at(IDENT)
|
||||
&& p.at_contextual_kw("raw")
|
||||
&& (p.nth_at(1, T![mut]) || p.nth_at(1, T![const]))
|
||||
{
|
||||
p.bump_remap(T![raw]);
|
||||
p.bump_any();
|
||||
} else {
|
||||
p.eat(T![mut]);
|
||||
}
|
||||
REF_EXPR
|
||||
}
|
||||
// test unary_expr
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue