mirror of
https://github.com/rust-lang/rust-analyzer.git
synced 2025-09-28 04:44:57 +00:00
internal: add result to minicore
This commit is contained in:
parent
ae92057df6
commit
0798cce9e5
2 changed files with 18 additions and 21 deletions
|
@ -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<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;
|
||||
}
|
||||
}
|
||||
"#,
|
||||
);
|
||||
}
|
||||
|
|
|
@ -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<T, E> {
|
||||
#[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 {
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue