diff options
author | Paul Daniel Faria <[email protected]> | 2020-08-07 00:58:37 +0100 |
---|---|---|
committer | Paul Daniel Faria <[email protected]> | 2020-08-07 00:58:37 +0100 |
commit | 6be528da0de45606498a9755ad2c54f3bc41dc6c (patch) | |
tree | d626ea2b13f1cf7a8134e7e9ad41224271325db7 /crates/ra_ide/src | |
parent | f1d507270c7d915ef0177feca7b6745d95169ac8 (diff) |
Add test for accessing static mut
Diffstat (limited to 'crates/ra_ide/src')
-rw-r--r-- | crates/ra_ide/src/syntax_highlighting/tests.rs | 7 |
1 files changed, 7 insertions, 0 deletions
diff --git a/crates/ra_ide/src/syntax_highlighting/tests.rs b/crates/ra_ide/src/syntax_highlighting/tests.rs index 2deee404c..b9b358022 100644 --- a/crates/ra_ide/src/syntax_highlighting/tests.rs +++ b/crates/ra_ide/src/syntax_highlighting/tests.rs | |||
@@ -281,6 +281,12 @@ impl HasUnsafeFn { | |||
281 | unsafe fn unsafe_method(&self) {} | 281 | unsafe fn unsafe_method(&self) {} |
282 | } | 282 | } |
283 | 283 | ||
284 | struct TypeForStaticMut { | ||
285 | a: u8 | ||
286 | } | ||
287 | |||
288 | static mut global_mut: TypeForStaticMut = TypeForStaticMut { a: 0 }; | ||
289 | |||
284 | fn main() { | 290 | fn main() { |
285 | let x = &5 as *const usize; | 291 | let x = &5 as *const usize; |
286 | unsafe { | 292 | unsafe { |
@@ -288,6 +294,7 @@ fn main() { | |||
288 | HasUnsafeFn.unsafe_method(); | 294 | HasUnsafeFn.unsafe_method(); |
289 | let y = *(x); | 295 | let y = *(x); |
290 | let z = -x; | 296 | let z = -x; |
297 | let a = global_mut.a; | ||
291 | } | 298 | } |
292 | } | 299 | } |
293 | "# | 300 | "# |