diff options
Diffstat (limited to 'crates/ra_hir_ty/src/tests.rs')
-rw-r--r-- | crates/ra_hir_ty/src/tests.rs | 22 |
1 files changed, 21 insertions, 1 deletions
diff --git a/crates/ra_hir_ty/src/tests.rs b/crates/ra_hir_ty/src/tests.rs index 8889fa3ba..4bc2e8b27 100644 --- a/crates/ra_hir_ty/src/tests.rs +++ b/crates/ra_hir_ty/src/tests.rs | |||
@@ -608,10 +608,30 @@ fn no_missing_unsafe_diagnostic_with_raw_ptr_in_unsafe_block() { | |||
608 | r" | 608 | r" |
609 | //- /lib.rs | 609 | //- /lib.rs |
610 | fn nothing_to_see_move_along() { | 610 | fn nothing_to_see_move_along() { |
611 | let x = &5 as *const usize; | ||
612 | unsafe { | ||
613 | let y = *x; | ||
614 | } | ||
615 | } | ||
616 | ", | ||
617 | ) | ||
618 | .diagnostics() | ||
619 | .0; | ||
620 | |||
621 | assert_snapshot!(diagnostics, @""); | ||
622 | } | ||
623 | |||
624 | #[test] | ||
625 | fn missing_unsafe_diagnostic_with_raw_ptr_outside_unsafe_block() { | ||
626 | let diagnostics = TestDB::with_files( | ||
627 | r" | ||
628 | //- /lib.rs | ||
629 | fn nothing_to_see_move_along() { | ||
630 | let x = &5 as *const usize; | ||
611 | unsafe { | 631 | unsafe { |
612 | let x = &5 as *const usize; | ||
613 | let y = *x; | 632 | let y = *x; |
614 | } | 633 | } |
634 | let z = *x; | ||
615 | } | 635 | } |
616 | ", | 636 | ", |
617 | ) | 637 | ) |