Commit 06cf088
authored
Add raw borrow operator as a contextual keyword (#586)
* Revert "Add keyword `raw` (#585)"
This reverts commit 6482f56.
The raw borrow operator is a weak keyword,
as such, it must only be highlighted in the right context.
Weak keywords:
https://doc.rust-lang.org/reference/keywords.html#weak-keywords
* Add `raw` borrow operator as a contextual keyword
The `raw` borrow operator is a contextual keyword.
Highlight it only in the context of borrows.
```rust
let mut x = 5;
// highlight "raw" here
let a = &raw const x;
let b = &raw mut x;
// do not highlight "raw" here
let raw = &x as *const _;
let raw_mut = &x as *mut _;
```
Raw borrow operator:
https://doc.rust-lang.org/reference/expressions/operator-expr.html#raw-borrow-operators
Rust weak keywords:
https://doc.rust-lang.org/reference/keywords.html#weak-keywords1 parent 6482f56 commit 06cf088
2 files changed
Lines changed: 32 additions & 1 deletion
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
1979 | 1979 | | |
1980 | 1980 | | |
1981 | 1981 | | |
| 1982 | + | |
| 1983 | + | |
| 1984 | + | |
| 1985 | + | |
| 1986 | + | |
| 1987 | + | |
| 1988 | + | |
| 1989 | + | |
| 1990 | + | |
| 1991 | + | |
| 1992 | + | |
| 1993 | + | |
| 1994 | + | |
| 1995 | + | |
| 1996 | + | |
| 1997 | + | |
| 1998 | + | |
| 1999 | + | |
| 2000 | + | |
| 2001 | + | |
| 2002 | + | |
| 2003 | + | |
1982 | 2004 | | |
1983 | 2005 | | |
1984 | 2006 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
112 | 112 | | |
113 | 113 | | |
114 | 114 | | |
| 115 | + | |
| 116 | + | |
| 117 | + | |
| 118 | + | |
| 119 | + | |
| 120 | + | |
| 121 | + | |
| 122 | + | |
115 | 123 | | |
116 | 124 | | |
117 | 125 | | |
| |||
188 | 196 | | |
189 | 197 | | |
190 | 198 | | |
191 | | - | |
| 199 | + | |
192 | 200 | | |
193 | 201 | | |
194 | 202 | | |
| |||
269 | 277 | | |
270 | 278 | | |
271 | 279 | | |
| 280 | + | |
272 | 281 | | |
273 | 282 | | |
274 | 283 | | |
| |||
0 commit comments