diff options
author | Paul Daniel Faria <[email protected]> | 2020-06-15 12:41:13 +0100 |
---|---|---|
committer | Paul Daniel Faria <[email protected]> | 2020-08-10 13:44:54 +0100 |
commit | 4a4b1f48efeff4ebe578eb92b7bb8338d0181a83 (patch) | |
tree | 1b124401d7b812d5dc06b8b63a56ca98d6281005 /crates/ra_ide/src/syntax_highlighting | |
parent | fd30134cf84b134259fe8140e513b152e37f3f88 (diff) |
Limit scope of unsafe to & instead of all ref exprs, add test showing missing support for autoref behavior
Diffstat (limited to 'crates/ra_ide/src/syntax_highlighting')
-rw-r--r-- | crates/ra_ide/src/syntax_highlighting/tests.rs | 19 |
1 files changed, 19 insertions, 0 deletions
diff --git a/crates/ra_ide/src/syntax_highlighting/tests.rs b/crates/ra_ide/src/syntax_highlighting/tests.rs index f2c078d34..c40805850 100644 --- a/crates/ra_ide/src/syntax_highlighting/tests.rs +++ b/crates/ra_ide/src/syntax_highlighting/tests.rs | |||
@@ -299,6 +299,23 @@ struct Packed { | |||
299 | c: u32, | 299 | c: u32, |
300 | } | 300 | } |
301 | 301 | ||
302 | trait DoTheAutoref { | ||
303 | fn calls_autoref(&self); | ||
304 | } | ||
305 | |||
306 | struct NeedsAlign { | ||
307 | a: u16 | ||
308 | } | ||
309 | |||
310 | #[repr(packed)] | ||
311 | struct HasAligned { | ||
312 | a: NeedsAlign | ||
313 | } | ||
314 | |||
315 | impl DoTheAutoref for NeedsAlign { | ||
316 | fn calls_autored(&self) {} | ||
317 | } | ||
318 | |||
302 | fn main() { | 319 | fn main() { |
303 | let x = &5 as *const usize; | 320 | let x = &5 as *const usize; |
304 | let u = Union { b: 0 }; | 321 | let u = Union { b: 0 }; |
@@ -317,6 +334,8 @@ fn main() { | |||
317 | let a = &packed.a; | 334 | let a = &packed.a; |
318 | let b = &packed.b; | 335 | let b = &packed.b; |
319 | let c = &packed.c; | 336 | let c = &packed.c; |
337 | let h = HasAligned{ a: NeedsAlign { a: 1 } }; | ||
338 | h.a.calls_autoref(); | ||
320 | } | 339 | } |
321 | } | 340 | } |
322 | "# | 341 | "# |