aboutsummaryrefslogtreecommitdiff
path: root/crates/ra_parser/src/grammar
diff options
context:
space:
mode:
authorbors[bot] <26634292+bors[bot]@users.noreply.github.com>2020-05-29 16:04:35 +0100
committerGitHub <[email protected]>2020-05-29 16:04:35 +0100
commit30658b25d2bb00ec495e0f3396de772141482081 (patch)
tree2846ebee3a16875674aed26b534f905a30cb598f /crates/ra_parser/src/grammar
parent190a0595a478d059fdd95a179fe38d59cb6379be (diff)
parent367487fe88dca78cffad5138673d5259f7f7ba6b (diff)
Merge #4648
4648: Support raw_ref_op's raw reference operator r=matklad a=robojumper Fixes #4642. This syntax (and its semantics) are implemented in rustc behind the `raw_ref_op` feature. It is not entirely clear whether this is the syntax that will become stable, but [it seems like](https://github.com/rust-lang/rust/pull/72279) rust-analyzer must still support this unstable syntax to support future stable rust. Also fixes a random inference failure involving a direct coercion from `&[T, _]` to `*const [T]`. Co-authored-by: robojumper <[email protected]>
Diffstat (limited to 'crates/ra_parser/src/grammar')
-rw-r--r--crates/ra_parser/src/grammar/expressions.rs16
1 files changed, 15 insertions, 1 deletions
diff --git a/crates/ra_parser/src/grammar/expressions.rs b/crates/ra_parser/src/grammar/expressions.rs
index 34f039768..d6e8df32a 100644
--- a/crates/ra_parser/src/grammar/expressions.rs
+++ b/crates/ra_parser/src/grammar/expressions.rs
@@ -325,13 +325,27 @@ fn lhs(p: &mut Parser, r: Restrictions) -> Option<(CompletedMarker, BlockLike)>
325 let kind = match p.current() { 325 let kind = match p.current() {
326 // test ref_expr 326 // test ref_expr
327 // fn foo() { 327 // fn foo() {
328 // // reference operator
328 // let _ = &1; 329 // let _ = &1;
329 // let _ = &mut &f(); 330 // let _ = &mut &f();
331 // let _ = &raw;
332 // let _ = &raw.0;
333 // // raw reference operator
334 // let _ = &raw mut foo;
335 // let _ = &raw const foo;
330 // } 336 // }
331 T![&] => { 337 T![&] => {
332 m = p.start(); 338 m = p.start();
333 p.bump(T![&]); 339 p.bump(T![&]);
334 p.eat(T![mut]); 340 if p.at(IDENT)
341 && p.at_contextual_kw("raw")
342 && (p.nth_at(1, T![mut]) || p.nth_at(1, T![const]))
343 {
344 p.bump_remap(T![raw]);
345 p.bump_any();
346 } else {
347 p.eat(T![mut]);
348 }
335 REF_EXPR 349 REF_EXPR
336 } 350 }
337 // test unary_expr 351 // test unary_expr