From a6532905a983c4a3f035fde95ec288dc751f833a Mon Sep 17 00:00:00 2001 From: Paul Daniel Faria Date: Thu, 6 Aug 2020 21:15:31 -0400 Subject: Add test for unsafe union field access highlighting --- crates/ra_ide/src/syntax_highlighting/tests.rs | 11 +++++++++++ 1 file changed, 11 insertions(+) (limited to 'crates/ra_ide/src/syntax_highlighting/tests.rs') diff --git a/crates/ra_ide/src/syntax_highlighting/tests.rs b/crates/ra_ide/src/syntax_highlighting/tests.rs index 2deee404c..a09422da3 100644 --- a/crates/ra_ide/src/syntax_highlighting/tests.rs +++ b/crates/ra_ide/src/syntax_highlighting/tests.rs @@ -275,6 +275,11 @@ fn test_unsafe_highlighting() { r#" unsafe fn unsafe_fn() {} +union Union { + a: u32, + b: f32, +} + struct HasUnsafeFn; impl HasUnsafeFn { @@ -283,8 +288,14 @@ impl HasUnsafeFn { fn main() { let x = &5 as *const usize; + let u = Union { b: 0 }; unsafe { unsafe_fn(); + let b = u.b; + match u { + Union { b: 0 } => (), + Union { a } => (), + } HasUnsafeFn.unsafe_method(); let y = *(x); let z = -x; -- cgit v1.2.3