From 0798cce9e564774b663fd965aaf2ef7e5778cb3f Mon Sep 17 00:00:00 2001 From: Aleksey Kladov Date: Tue, 15 Jun 2021 23:07:25 +0300 Subject: internal: add result to minicore --- crates/hir_ty/src/tests/traits.rs | 20 +------------------- crates/test_utils/src/minicore.rs | 19 +++++++++++++++++-- 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 { fn infer_async_ret_type() { check_types( r#" -//- /main.rs crate:main deps:core - -enum Result { - Ok(T), - Err(E), -} - -use Result::*; - - +//- minicore: future, result struct Fooey; impl Fooey { @@ -3659,15 +3650,6 @@ async fn get_accounts() -> Result { // ^ u32 Ok(ret) } - -//- /core.rs crate:core -#[prelude_import] use future::*; -mod future { - #[lang = "future_trait"] - trait Future { - type Output; - } -} "#, ); } 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 @@ //! pin: //! future: pin //! option: +//! result: pub mod marker { // region:sized @@ -127,6 +128,17 @@ pub mod option { } // endregion:option +// region:result +pub mod result { + pub enum Result { + #[lang = "Ok"] + Ok(T), + #[lang = "Err"] + Err(E), + } +} +// endregion:result + // region:pin pub mod pin { #[lang = "pin"] @@ -167,8 +179,11 @@ pub mod task { 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 { -- cgit v1.2.3