diff options
-rw-r--r-- | crates/hir_ty/src/tests/regression.rs | 50 | ||||
-rw-r--r-- | crates/hir_ty/src/tests/traits.rs | 37 |
2 files changed, 32 insertions, 55 deletions
diff --git a/crates/hir_ty/src/tests/regression.rs b/crates/hir_ty/src/tests/regression.rs index 1019e783b..1e0233b55 100644 --- a/crates/hir_ty/src/tests/regression.rs +++ b/crates/hir_ty/src/tests/regression.rs | |||
@@ -927,35 +927,33 @@ fn issue_6628() { | |||
927 | fn issue_6852() { | 927 | fn issue_6852() { |
928 | check_infer( | 928 | check_infer( |
929 | r#" | 929 | r#" |
930 | #[lang = "deref"] | 930 | //- minicore: deref |
931 | pub trait Deref { | 931 | use core::ops::Deref; |
932 | type Target; | ||
933 | } | ||
934 | 932 | ||
935 | struct BufWriter {} | 933 | struct BufWriter {} |
936 | 934 | ||
937 | struct Mutex<T> {} | 935 | struct Mutex<T> {} |
938 | struct MutexGuard<'a, T> {} | 936 | struct MutexGuard<'a, T> {} |
939 | impl<T> Mutex<T> { | 937 | impl<T> Mutex<T> { |
940 | fn lock(&self) -> MutexGuard<'_, T> {} | 938 | fn lock(&self) -> MutexGuard<'_, T> {} |
941 | } | 939 | } |
942 | impl<'a, T: 'a> Deref for MutexGuard<'a, T> { | 940 | impl<'a, T: 'a> Deref for MutexGuard<'a, T> { |
943 | type Target = T; | 941 | type Target = T; |
944 | } | 942 | } |
945 | fn flush(&self) { | 943 | fn flush(&self) { |
946 | let w: &Mutex<BufWriter>; | 944 | let w: &Mutex<BufWriter>; |
947 | *(w.lock()); | 945 | *(w.lock()); |
948 | } | 946 | } |
949 | "#, | 947 | "#, |
950 | expect![[r#" | 948 | expect![[r#" |
951 | 156..160 'self': &Mutex<T> | 949 | 123..127 'self': &Mutex<T> |
952 | 183..185 '{}': () | 950 | 150..152 '{}': () |
953 | 267..271 'self': &{unknown} | 951 | 234..238 'self': &{unknown} |
954 | 273..323 '{ ...()); }': () | 952 | 240..290 '{ ...()); }': () |
955 | 283..284 'w': &Mutex<BufWriter> | 953 | 250..251 'w': &Mutex<BufWriter> |
956 | 309..320 '*(w.lock())': BufWriter | 954 | 276..287 '*(w.lock())': BufWriter |
957 | 311..312 'w': &Mutex<BufWriter> | 955 | 278..279 'w': &Mutex<BufWriter> |
958 | 311..319 'w.lock()': MutexGuard<BufWriter> | 956 | 278..286 'w.lock()': MutexGuard<BufWriter> |
959 | "#]], | 957 | "#]], |
960 | ); | 958 | ); |
961 | } | 959 | } |
diff --git a/crates/hir_ty/src/tests/traits.rs b/crates/hir_ty/src/tests/traits.rs index c830e576e..d237c3998 100644 --- a/crates/hir_ty/src/tests/traits.rs +++ b/crates/hir_ty/src/tests/traits.rs | |||
@@ -704,14 +704,9 @@ mod ops { | |||
704 | fn deref_trait() { | 704 | fn deref_trait() { |
705 | check_types( | 705 | check_types( |
706 | r#" | 706 | r#" |
707 | #[lang = "deref"] | 707 | //- minicore: deref |
708 | trait Deref { | ||
709 | type Target; | ||
710 | fn deref(&self) -> &Self::Target; | ||
711 | } | ||
712 | |||
713 | struct Arc<T>; | 708 | struct Arc<T>; |
714 | impl<T> Deref for Arc<T> { | 709 | impl<T> core::ops::Deref for Arc<T> { |
715 | type Target = T; | 710 | type Target = T; |
716 | } | 711 | } |
717 | 712 | ||
@@ -731,16 +726,10 @@ fn test(s: Arc<S>) { | |||
731 | fn deref_trait_with_inference_var() { | 726 | fn deref_trait_with_inference_var() { |
732 | check_types( | 727 | check_types( |
733 | r#" | 728 | r#" |
734 | //- /main.rs | 729 | //- minicore: deref |
735 | #[lang = "deref"] | ||
736 | trait Deref { | ||
737 | type Target; | ||
738 | fn deref(&self) -> &Self::Target; | ||
739 | } | ||
740 | |||
741 | struct Arc<T>; | 730 | struct Arc<T>; |
742 | fn new_arc<T>() -> Arc<T> {} | 731 | fn new_arc<T>() -> Arc<T> {} |
743 | impl<T> Deref for Arc<T> { | 732 | impl<T> core::ops::Deref for Arc<T> { |
744 | type Target = T; | 733 | type Target = T; |
745 | } | 734 | } |
746 | 735 | ||
@@ -761,15 +750,10 @@ fn test() { | |||
761 | fn deref_trait_infinite_recursion() { | 750 | fn deref_trait_infinite_recursion() { |
762 | check_types( | 751 | check_types( |
763 | r#" | 752 | r#" |
764 | #[lang = "deref"] | 753 | //- minicore: deref |
765 | trait Deref { | ||
766 | type Target; | ||
767 | fn deref(&self) -> &Self::Target; | ||
768 | } | ||
769 | |||
770 | struct S; | 754 | struct S; |
771 | 755 | ||
772 | impl Deref for S { | 756 | impl core::ops::Deref for S { |
773 | type Target = S; | 757 | type Target = S; |
774 | } | 758 | } |
775 | 759 | ||
@@ -784,14 +768,9 @@ fn test(s: S) { | |||
784 | fn deref_trait_with_question_mark_size() { | 768 | fn deref_trait_with_question_mark_size() { |
785 | check_types( | 769 | check_types( |
786 | r#" | 770 | r#" |
787 | #[lang = "deref"] | 771 | //- minicore: deref |
788 | trait Deref { | ||
789 | type Target; | ||
790 | fn deref(&self) -> &Self::Target; | ||
791 | } | ||
792 | |||
793 | struct Arc<T>; | 772 | struct Arc<T>; |
794 | impl<T> Deref for Arc<T> { | 773 | impl<T: ?Sized> core::ops::Deref for Arc<T> { |
795 | type Target = T; | 774 | type Target = T; |
796 | } | 775 | } |
797 | 776 | ||