diff options
author | Aleksey Kladov <[email protected]> | 2021-06-15 20:59:51 +0100 |
---|---|---|
committer | Aleksey Kladov <[email protected]> | 2021-06-15 20:59:51 +0100 |
commit | 2870d2bade94ae276cba56caf8c35feaacd49422 (patch) | |
tree | 4f2e0f2f070d44d408d24a087d9fb9d06d499b6d /crates/hir_ty | |
parent | 3efe5c3426a311b6d617f9718b82e9a598dfa06d (diff) |
internal: add option to minicore
Diffstat (limited to 'crates/hir_ty')
-rw-r--r-- | crates/hir_ty/src/tests/traits.rs | 46 |
1 files changed, 6 insertions, 40 deletions
diff --git a/crates/hir_ty/src/tests/traits.rs b/crates/hir_ty/src/tests/traits.rs index 33689e081..6df8181ed 100644 --- a/crates/hir_ty/src/tests/traits.rs +++ b/crates/hir_ty/src/tests/traits.rs | |||
@@ -26,25 +26,14 @@ fn test() { | |||
26 | fn infer_async() { | 26 | fn infer_async() { |
27 | check_types( | 27 | check_types( |
28 | r#" | 28 | r#" |
29 | //- /main.rs crate:main deps:core | 29 | //- minicore: future |
30 | async fn foo() -> u64 { | 30 | async fn foo() -> u64 { 128 } |
31 | 128 | ||
32 | } | ||
33 | 31 | ||
34 | fn test() { | 32 | fn test() { |
35 | let r = foo(); | 33 | let r = foo(); |
36 | let v = r.await; | 34 | let v = r.await; |
37 | v; | 35 | v; |
38 | } //^ u64 | 36 | } //^ u64 |
39 | |||
40 | //- /core.rs crate:core | ||
41 | #[prelude_import] use future::*; | ||
42 | mod future { | ||
43 | #[lang = "future_trait"] | ||
44 | trait Future { | ||
45 | type Output; | ||
46 | } | ||
47 | } | ||
48 | "#, | 37 | "#, |
49 | ); | 38 | ); |
50 | } | 39 | } |
@@ -53,24 +42,13 @@ mod future { | |||
53 | fn infer_desugar_async() { | 42 | fn infer_desugar_async() { |
54 | check_types( | 43 | check_types( |
55 | r#" | 44 | r#" |
56 | //- /main.rs crate:main deps:core | 45 | //- minicore: future |
57 | async fn foo() -> u64 { | 46 | async fn foo() -> u64 { 128 } |
58 | 128 | ||
59 | } | ||
60 | 47 | ||
61 | fn test() { | 48 | fn test() { |
62 | let r = foo(); | 49 | let r = foo(); |
63 | r; | 50 | r; |
64 | } //^ impl Future<Output = u64> | 51 | } //^ impl Future<Output = u64> |
65 | |||
66 | //- /core.rs crate:core | ||
67 | #[prelude_import] use future::*; | ||
68 | mod future { | ||
69 | trait Future { | ||
70 | type Output; | ||
71 | } | ||
72 | } | ||
73 | |||
74 | "#, | 52 | "#, |
75 | ); | 53 | ); |
76 | } | 54 | } |
@@ -79,7 +57,7 @@ mod future { | |||
79 | fn infer_async_block() { | 57 | fn infer_async_block() { |
80 | check_types( | 58 | check_types( |
81 | r#" | 59 | r#" |
82 | //- /main.rs crate:main deps:core | 60 | //- minicore: future, option |
83 | async fn test() { | 61 | async fn test() { |
84 | let a = async { 42 }; | 62 | let a = async { 42 }; |
85 | a; | 63 | a; |
@@ -91,7 +69,7 @@ async fn test() { | |||
91 | b; | 69 | b; |
92 | // ^ () | 70 | // ^ () |
93 | let c = async { | 71 | let c = async { |
94 | let y = Option::None; | 72 | let y = None; |
95 | y | 73 | y |
96 | // ^ Option<u64> | 74 | // ^ Option<u64> |
97 | }; | 75 | }; |
@@ -99,18 +77,6 @@ async fn test() { | |||
99 | c; | 77 | c; |
100 | // ^ impl Future<Output = Option<u64>> | 78 | // ^ impl Future<Output = Option<u64>> |
101 | } | 79 | } |
102 | |||
103 | enum Option<T> { None, Some(T) } | ||
104 | |||
105 | //- /core.rs crate:core | ||
106 | #[prelude_import] use future::*; | ||
107 | mod future { | ||
108 | #[lang = "future_trait"] | ||
109 | trait Future { | ||
110 | type Output; | ||
111 | } | ||
112 | } | ||
113 | |||
114 | "#, | 80 | "#, |
115 | ); | 81 | ); |
116 | } | 82 | } |