]> git.lizzy.rs Git - rust.git/commitdiff
internal: add result to minicore
authorAleksey Kladov <aleksey.kladov@gmail.com>
Tue, 15 Jun 2021 20:07:25 +0000 (23:07 +0300)
committerAleksey Kladov <aleksey.kladov@gmail.com>
Tue, 15 Jun 2021 20:07:25 +0000 (23:07 +0300)
crates/hir_ty/src/tests/traits.rs
crates/test_utils/src/minicore.rs

index 6df8181ed094ce7c3b6d96872e3a81f5ea7fc5e4..65fed02d24f1f7dfd0e73922c6338f6ead3298a7 100644 (file)
@@ -3627,16 +3627,7 @@ fn foo(self) {
 fn infer_async_ret_type() {
     check_types(
         r#"
-//- /main.rs crate:main deps:core
-
-enum Result<T, E> {
-    Ok(T),
-    Err(E),
-}
-
-use Result::*;
-
-
+//- minicore: future, result
 struct Fooey;
 
 impl Fooey {
@@ -3659,15 +3650,6 @@ async fn get_accounts() -> Result<u32, ()> {
     //                      ^ u32
     Ok(ret)
 }
-
-//- /core.rs crate:core
-#[prelude_import] use future::*;
-mod future {
-    #[lang = "future_trait"]
-    trait Future {
-        type Output;
-    }
-}
 "#,
     );
 }
index cb18c8796cf2e4143728f5eebb65ed32d18e0e94..5ff60178ce651e087616c9c2fd0307f7f4852a59 100644 (file)
@@ -17,6 +17,7 @@
 //!     pin:
 //!     future: pin
 //!     option:
+//!     result:
 
 pub mod marker {
     // region:sized
@@ -127,6 +128,17 @@ pub enum Option<T> {
 }
 // endregion:option
 
+// region:result
+pub mod result {
+    pub enum Result<T, E> {
+        #[lang = "Ok"]
+        Ok(T),
+        #[lang = "Err"]
+        Err(E),
+    }
+}
+// endregion:result
+
 // region:pin
 pub mod pin {
     #[lang = "pin"]
@@ -167,8 +179,11 @@ pub struct Context<'a> {
 
 pub mod prelude {
     pub mod v1 {
-        pub use crate::marker::Sized; // :sized
-        pub use crate::option::Option::{self, None, Some}; // :option
+        pub use crate::{
+            marker::Sized,                      // :sized
+            option::Option::{self, None, Some}, // :option
+            result::Result::{self, Err, Ok},    // :result
+        };
     }
 
     pub mod rust_2015 {