From cc3eb8531177940ad34ff505f0426151b985daf3 Mon Sep 17 00:00:00 2001 From: Paul Daniel Faria Date: Tue, 4 Aug 2020 09:23:23 -0400 Subject: Add test showing unresolved module rename --- crates/ra_ide/src/syntax_highlighting/tests.rs | 3 +++ 1 file changed, 3 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 87a6e2523..2deee404c 100644 --- a/crates/ra_ide/src/syntax_highlighting/tests.rs +++ b/crates/ra_ide/src/syntax_highlighting/tests.rs @@ -9,6 +9,9 @@ use crate::{mock_analysis::single_file, FileRange, TextRange}; fn test_highlighting() { check_highlighting( r#" +use inner::{self as inner_mod}; +mod inner {} + #[derive(Clone, Debug)] struct Foo { pub x: i32, -- cgit v1.2.3 From 6be528da0de45606498a9755ad2c54f3bc41dc6c Mon Sep 17 00:00:00 2001 From: Paul Daniel Faria Date: Thu, 6 Aug 2020 19:58:37 -0400 Subject: Add test for accessing static mut --- crates/ra_ide/src/syntax_highlighting/tests.rs | 7 +++++++ 1 file changed, 7 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..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 { unsafe fn unsafe_method(&self) {} } +struct TypeForStaticMut { + a: u8 +} + +static mut global_mut: TypeForStaticMut = TypeForStaticMut { a: 0 }; + fn main() { let x = &5 as *const usize; unsafe { @@ -288,6 +294,7 @@ fn main() { HasUnsafeFn.unsafe_method(); let y = *(x); let z = -x; + let a = global_mut.a; } } "# -- cgit v1.2.3 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