From 55633f34048434de18d54b4300bca186db052cf5 Mon Sep 17 00:00:00 2001 From: Paul Daniel Faria Date: Thu, 23 Jul 2020 09:31:07 -0400 Subject: Fix rebase errors --- crates/ra_ide/test_data/highlight_doctest.html | 2 +- crates/ra_ide/test_data/highlight_injection.html | 2 +- crates/ra_ide/test_data/highlight_unsafe.html | 5 +++-- crates/ra_ide/test_data/highlighting.html | 10 +++++----- 4 files changed, 10 insertions(+), 9 deletions(-) (limited to 'crates/ra_ide/test_data') diff --git a/crates/ra_ide/test_data/highlight_doctest.html b/crates/ra_ide/test_data/highlight_doctest.html index 6322d404f..46c1e0a11 100644 --- a/crates/ra_ide/test_data/highlight_doctest.html +++ b/crates/ra_ide/test_data/highlight_doctest.html @@ -87,7 +87,7 @@ pre { color: #DCDCCC; background: #3F3F3F; font-size: 22px; padd /// ```sh /// echo 1 /// ``` - pub fn foo(&self) -> bool { + pub fn foo(&self) -> bool { true } } diff --git a/crates/ra_ide/test_data/highlight_injection.html b/crates/ra_ide/test_data/highlight_injection.html index 18addd00d..60c394399 100644 --- a/crates/ra_ide/test_data/highlight_injection.html +++ b/crates/ra_ide/test_data/highlight_injection.html @@ -35,7 +35,7 @@ pre { color: #DCDCCC; background: #3F3F3F; font-size: 22px; padd .unresolved_reference { color: #FC5555; text-decoration: wavy underline; } -
fn fixture(ra_fixture: &str) {}
+
fn fixture(ra_fixture: &str) {}
 
 fn main() {
     fixture(r#"
diff --git a/crates/ra_ide/test_data/highlight_unsafe.html b/crates/ra_ide/test_data/highlight_unsafe.html
index 79409fe81..454ff6d5f 100644
--- a/crates/ra_ide/test_data/highlight_unsafe.html
+++ b/crates/ra_ide/test_data/highlight_unsafe.html
@@ -45,7 +45,7 @@ pre                 { color: #DCDCCC; background: #3F3F3F; font-size: 22px; padd
 struct HasUnsafeFn;
 
 impl HasUnsafeFn {
-    unsafe fn unsafe_method(&self) {}
+    unsafe fn unsafe_method(&self) {}
 }
 
 struct TypeForStaticMut {
@@ -55,9 +55,10 @@ pre                 { color: #DCDCCC; background: #3F3F3F; font-size: 22px; padd
 static mut global_mut: TypeForStaticMut = TypeForStaticMut { a: 0 };
 
 fn main() {
-    let x = &5 as *const usize;
+    let x = &5 as *const _ as *const usize;
     let u = Union { b: 0 };
     unsafe {
+        // unsafe fn and method calls
         unsafe_fn();
         let b = u.b;
         match u {
diff --git a/crates/ra_ide/test_data/highlighting.html b/crates/ra_ide/test_data/highlighting.html
index 8e0160eee..678cf9bd3 100644
--- a/crates/ra_ide/test_data/highlighting.html
+++ b/crates/ra_ide/test_data/highlighting.html
@@ -45,11 +45,11 @@ pre                 { color: #DCDCCC; background: #3F3F3F; font-size: 22px; padd
 }
 
 trait Bar {
-    fn bar(&self) -> i32;
+    fn bar(&self) -> i32;
 }
 
 impl Bar for Foo {
-    fn bar(&self) -> i32 {
+    fn bar(&self) -> i32 {
         self.x
     }
 }
@@ -59,7 +59,7 @@ pre                 { color: #DCDCCC; background: #3F3F3F; font-size: 22px; padd
         self.x
     }
 
-    fn qux(&mut self) {
+    fn qux(&mut self) {
         self.x = 0;
     }
 }
@@ -107,8 +107,8 @@ pre                 { color: #DCDCCC; background: #3F3F3F; font-size: 22px; padd
     noop!(noop!(1));
 
     let mut x = 42;
-    let y = &mut x;
-    let z = &y;
+    let y = &mut x;
+    let z = &y;
 
     let Foo { x: z, y } = Foo { x: z, y };
 
-- 
cgit v1.2.3


From a6af0272f7bf129a3063cdd7096f685fc58438e6 Mon Sep 17 00:00:00 2001
From: Paul Daniel Faria 
Date: Thu, 23 Jul 2020 10:11:37 -0400
Subject: Move semantic logic into Semantics, fix missing tag for safe amp
 operator, using functional methods rather than clunky inline closure

---
 crates/ra_ide/test_data/highlight_doctest.html   |  2 +-
 crates/ra_ide/test_data/highlight_injection.html |  2 +-
 crates/ra_ide/test_data/highlight_unsafe.html    |  4 ++--
 crates/ra_ide/test_data/highlighting.html        | 10 +++++-----
 4 files changed, 9 insertions(+), 9 deletions(-)

(limited to 'crates/ra_ide/test_data')

diff --git a/crates/ra_ide/test_data/highlight_doctest.html b/crates/ra_ide/test_data/highlight_doctest.html
index 46c1e0a11..6322d404f 100644
--- a/crates/ra_ide/test_data/highlight_doctest.html
+++ b/crates/ra_ide/test_data/highlight_doctest.html
@@ -87,7 +87,7 @@ pre                 { color: #DCDCCC; background: #3F3F3F; font-size: 22px; padd
     /// ```sh
     /// echo 1
     /// ```
-    pub fn foo(&self) -> bool {
+    pub fn foo(&self) -> bool {
         true
     }
 }
diff --git a/crates/ra_ide/test_data/highlight_injection.html b/crates/ra_ide/test_data/highlight_injection.html
index 60c394399..18addd00d 100644
--- a/crates/ra_ide/test_data/highlight_injection.html
+++ b/crates/ra_ide/test_data/highlight_injection.html
@@ -35,7 +35,7 @@ pre                 { color: #DCDCCC; background: #3F3F3F; font-size: 22px; padd
 
 .unresolved_reference { color: #FC5555; text-decoration: wavy underline; }
 
-
fn fixture(ra_fixture: &str) {}
+
fn fixture(ra_fixture: &str) {}
 
 fn main() {
     fixture(r#"
diff --git a/crates/ra_ide/test_data/highlight_unsafe.html b/crates/ra_ide/test_data/highlight_unsafe.html
index 454ff6d5f..a2df2c27e 100644
--- a/crates/ra_ide/test_data/highlight_unsafe.html
+++ b/crates/ra_ide/test_data/highlight_unsafe.html
@@ -45,7 +45,7 @@ pre                 { color: #DCDCCC; background: #3F3F3F; font-size: 22px; padd
 struct HasUnsafeFn;
 
 impl HasUnsafeFn {
-    unsafe fn unsafe_method(&self) {}
+    unsafe fn unsafe_method(&self) {}
 }
 
 struct TypeForStaticMut {
@@ -55,7 +55,7 @@ pre                 { color: #DCDCCC; background: #3F3F3F; font-size: 22px; padd
 static mut global_mut: TypeForStaticMut = TypeForStaticMut { a: 0 };
 
 fn main() {
-    let x = &5 as *const _ as *const usize;
+    let x = &5 as *const _ as *const usize;
     let u = Union { b: 0 };
     unsafe {
         // unsafe fn and method calls
diff --git a/crates/ra_ide/test_data/highlighting.html b/crates/ra_ide/test_data/highlighting.html
index 678cf9bd3..8e0160eee 100644
--- a/crates/ra_ide/test_data/highlighting.html
+++ b/crates/ra_ide/test_data/highlighting.html
@@ -45,11 +45,11 @@ pre                 { color: #DCDCCC; background: #3F3F3F; font-size: 22px; padd
 }
 
 trait Bar {
-    fn bar(&self) -> i32;
+    fn bar(&self) -> i32;
 }
 
 impl Bar for Foo {
-    fn bar(&self) -> i32 {
+    fn bar(&self) -> i32 {
         self.x
     }
 }
@@ -59,7 +59,7 @@ pre                 { color: #DCDCCC; background: #3F3F3F; font-size: 22px; padd
         self.x
     }
 
-    fn qux(&mut self) {
+    fn qux(&mut self) {
         self.x = 0;
     }
 }
@@ -107,8 +107,8 @@ pre                 { color: #DCDCCC; background: #3F3F3F; font-size: 22px; padd
     noop!(noop!(1));
 
     let mut x = 42;
-    let y = &mut x;
-    let z = &y;
+    let y = &mut x;
+    let z = &y;
 
     let Foo { x: z, y } = Foo { x: z, y };
 
-- 
cgit v1.2.3


From 2199d0cda9c745ecb460dd987b8da982d02bc130 Mon Sep 17 00:00:00 2001
From: Paul Daniel Faria 
Date: Fri, 7 Aug 2020 10:40:09 -0400
Subject: Fix type names broken by rebase, redo expected test because of rebase

---
 crates/ra_ide/test_data/highlight_unsafe.html | 30 +++++++++++++++++++++++++--
 1 file changed, 28 insertions(+), 2 deletions(-)

(limited to 'crates/ra_ide/test_data')

diff --git a/crates/ra_ide/test_data/highlight_unsafe.html b/crates/ra_ide/test_data/highlight_unsafe.html
index a2df2c27e..552fea668 100644
--- a/crates/ra_ide/test_data/highlight_unsafe.html
+++ b/crates/ra_ide/test_data/highlight_unsafe.html
@@ -54,6 +54,19 @@ pre                 { color: #DCDCCC; background: #3F3F3F; font-size: 22px; padd
 
 static mut global_mut: TypeForStaticMut = TypeForStaticMut { a: 0 };
 
+#[repr(packed)]
+struct Packed {
+    a: u16,
+}
+
+trait DoTheAutoref {
+    fn calls_autoref(&self);
+}
+
+impl DoTheAutoref for u16 {
+    fn calls_autoref(&self) {}
+}
+
 fn main() {
     let x = &5 as *const _ as *const usize;
     let u = Union { b: 0 };
@@ -66,8 +79,21 @@ pre                 { color: #DCDCCC; background: #3F3F3F; font-size: 22px; padd
             Union { a } => (),
         }
         HasUnsafeFn.unsafe_method();
-        let y = *(x);
-        let z = -x;
+
+        // unsafe deref
+        let y = *x;
+
+        // unsafe access to a static mut
         let a = global_mut.a;
+
+        // unsafe ref of packed fields
+        let packed = Packed { a: 0 };
+        let a = &packed.a;
+        let ref a = packed.a;
+        let Packed { ref a } = packed;
+        let Packed { a: ref _a } = packed;
+
+        // unsafe auto ref of packed field
+        packed.a.calls_autoref();
     }
 }
\ No newline at end of file -- cgit v1.2.3