aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAleksey Kladov <[email protected]>2021-06-15 21:07:25 +0100
committerAleksey Kladov <[email protected]>2021-06-15 21:07:25 +0100
commit0798cce9e564774b663fd965aaf2ef7e5778cb3f (patch)
treea8e7906bb91b157ffaf71dd5daa3ed9f6ff84212
parentae92057df6608f6ab48317198a9d13a97f07f004 (diff)
internal: add result to minicore
-rw-r--r--crates/hir_ty/src/tests/traits.rs20
-rw-r--r--crates/test_utils/src/minicore.rs19
2 files changed, 18 insertions, 21 deletions
diff --git a/crates/hir_ty/src/tests/traits.rs b/crates/hir_ty/src/tests/traits.rs
index 6df8181ed..65fed02d2 100644
--- a/crates/hir_ty/src/tests/traits.rs
+++ b/crates/hir_ty/src/tests/traits.rs
@@ -3627,16 +3627,7 @@ impl foo::Foo for u32 {
3627fn infer_async_ret_type() { 3627fn infer_async_ret_type() {
3628 check_types( 3628 check_types(
3629 r#" 3629 r#"
3630//- /main.rs crate:main deps:core 3630//- minicore: future, result
3631
3632enum Result<T, E> {
3633 Ok(T),
3634 Err(E),
3635}
3636
3637use Result::*;
3638
3639
3640struct Fooey; 3631struct Fooey;
3641 3632
3642impl Fooey { 3633impl Fooey {
@@ -3659,15 +3650,6 @@ async fn get_accounts() -> Result<u32, ()> {
3659 // ^ u32 3650 // ^ u32
3660 Ok(ret) 3651 Ok(ret)
3661} 3652}
3662
3663//- /core.rs crate:core
3664#[prelude_import] use future::*;
3665mod future {
3666 #[lang = "future_trait"]
3667 trait Future {
3668 type Output;
3669 }
3670}
3671"#, 3653"#,
3672 ); 3654 );
3673} 3655}
diff --git a/crates/test_utils/src/minicore.rs b/crates/test_utils/src/minicore.rs
index cb18c8796..5ff60178c 100644
--- a/crates/test_utils/src/minicore.rs
+++ b/crates/test_utils/src/minicore.rs
@@ -17,6 +17,7 @@
17//! pin: 17//! pin:
18//! future: pin 18//! future: pin
19//! option: 19//! option:
20//! result:
20 21
21pub mod marker { 22pub mod marker {
22 // region:sized 23 // region:sized
@@ -127,6 +128,17 @@ pub mod option {
127} 128}
128// endregion:option 129// endregion:option
129 130
131// region:result
132pub mod result {
133 pub enum Result<T, E> {
134 #[lang = "Ok"]
135 Ok(T),
136 #[lang = "Err"]
137 Err(E),
138 }
139}
140// endregion:result
141
130// region:pin 142// region:pin
131pub mod pin { 143pub mod pin {
132 #[lang = "pin"] 144 #[lang = "pin"]
@@ -167,8 +179,11 @@ pub mod task {
167 179
168pub mod prelude { 180pub mod prelude {
169 pub mod v1 { 181 pub mod v1 {
170 pub use crate::marker::Sized; // :sized 182 pub use crate::{
171 pub use crate::option::Option::{self, None, Some}; // :option 183 marker::Sized, // :sized
184 option::Option::{self, None, Some}, // :option
185 result::Result::{self, Err, Ok}, // :result
186 };
172 } 187 }
173 188
174 pub mod rust_2015 { 189 pub mod rust_2015 {