aboutsummaryrefslogtreecommitdiff
path: root/crates
diff options
context:
space:
mode:
authorAleksey Kladov <[email protected]>2021-06-15 19:57:56 +0100
committerAleksey Kladov <[email protected]>2021-06-15 19:57:56 +0100
commitee13e895e337d01ea283a94b7896fddc0a922cb8 (patch)
tree668c259a6431246d14b2339f60ef64a229d9b9bc /crates
parent0bb1f1bc90ee0f0f92f55823fc2e0c12c6acb680 (diff)
internal: switch some tests to minicore
Diffstat (limited to 'crates')
-rw-r--r--crates/hir_ty/src/tests/regression.rs50
-rw-r--r--crates/hir_ty/src/tests/traits.rs37
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() {
927fn issue_6852() { 927fn issue_6852() {
928 check_infer( 928 check_infer(
929 r#" 929 r#"
930 #[lang = "deref"] 930//- minicore: deref
931 pub trait Deref { 931use core::ops::Deref;
932 type Target;
933 }
934 932
935 struct BufWriter {} 933struct BufWriter {}
936 934
937 struct Mutex<T> {} 935struct Mutex<T> {}
938 struct MutexGuard<'a, T> {} 936struct MutexGuard<'a, T> {}
939 impl<T> Mutex<T> { 937impl<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> { 940impl<'a, T: 'a> Deref for MutexGuard<'a, T> {
943 type Target = T; 941 type Target = T;
944 } 942}
945 fn flush(&self) { 943fn 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 {
704fn deref_trait() { 704fn deref_trait() {
705 check_types( 705 check_types(
706 r#" 706 r#"
707#[lang = "deref"] 707//- minicore: deref
708trait Deref {
709 type Target;
710 fn deref(&self) -> &Self::Target;
711}
712
713struct Arc<T>; 708struct Arc<T>;
714impl<T> Deref for Arc<T> { 709impl<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>) {
731fn deref_trait_with_inference_var() { 726fn deref_trait_with_inference_var() {
732 check_types( 727 check_types(
733 r#" 728 r#"
734//- /main.rs 729//- minicore: deref
735#[lang = "deref"]
736trait Deref {
737 type Target;
738 fn deref(&self) -> &Self::Target;
739}
740
741struct Arc<T>; 730struct Arc<T>;
742fn new_arc<T>() -> Arc<T> {} 731fn new_arc<T>() -> Arc<T> {}
743impl<T> Deref for Arc<T> { 732impl<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() {
761fn deref_trait_infinite_recursion() { 750fn deref_trait_infinite_recursion() {
762 check_types( 751 check_types(
763 r#" 752 r#"
764#[lang = "deref"] 753//- minicore: deref
765trait Deref {
766 type Target;
767 fn deref(&self) -> &Self::Target;
768}
769
770struct S; 754struct S;
771 755
772impl Deref for S { 756impl 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) {
784fn deref_trait_with_question_mark_size() { 768fn deref_trait_with_question_mark_size() {
785 check_types( 769 check_types(
786 r#" 770 r#"
787#[lang = "deref"] 771//- minicore: deref
788trait Deref {
789 type Target;
790 fn deref(&self) -> &Self::Target;
791}
792
793struct Arc<T>; 772struct Arc<T>;
794impl<T> Deref for Arc<T> { 773impl<T: ?Sized> core::ops::Deref for Arc<T> {
795 type Target = T; 774 type Target = T;
796} 775}
797 776