mirror of
https://github.com/rust-lang/rust-analyzer.git
synced 2025-09-28 12:54:58 +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() {
|
fn infer_async_ret_type() {
|
||||||
check_types(
|
check_types(
|
||||||
r#"
|
r#"
|
||||||
//- /main.rs crate:main deps:core
|
//- minicore: future, result
|
||||||
|
|
||||||
enum Result<T, E> {
|
|
||||||
Ok(T),
|
|
||||||
Err(E),
|
|
||||||
}
|
|
||||||
|
|
||||||
use Result::*;
|
|
||||||
|
|
||||||
|
|
||||||
struct Fooey;
|
struct Fooey;
|
||||||
|
|
||||||
impl Fooey {
|
impl Fooey {
|
||||||
|
@ -3659,15 +3650,6 @@ async fn get_accounts() -> Result<u32, ()> {
|
||||||
// ^ u32
|
// ^ u32
|
||||||
Ok(ret)
|
Ok(ret)
|
||||||
}
|
}
|
||||||
|
|
||||||
//- /core.rs crate:core
|
|
||||||
#[prelude_import] use future::*;
|
|
||||||
mod future {
|
|
||||||
#[lang = "future_trait"]
|
|
||||||
trait Future {
|
|
||||||
type Output;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
"#,
|
"#,
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
|
@ -17,6 +17,7 @@
|
||||||
//! pin:
|
//! pin:
|
||||||
//! future: pin
|
//! future: pin
|
||||||
//! option:
|
//! option:
|
||||||
|
//! result:
|
||||||
|
|
||||||
pub mod marker {
|
pub mod marker {
|
||||||
// region:sized
|
// region:sized
|
||||||
|
@ -127,6 +128,17 @@ pub mod option {
|
||||||
}
|
}
|
||||||
// endregion: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
|
// region:pin
|
||||||
pub mod pin {
|
pub mod pin {
|
||||||
#[lang = "pin"]
|
#[lang = "pin"]
|
||||||
|
@ -167,8 +179,11 @@ pub mod task {
|
||||||
|
|
||||||
pub mod prelude {
|
pub mod prelude {
|
||||||
pub mod v1 {
|
pub mod v1 {
|
||||||
pub use crate::marker::Sized; // :sized
|
pub use crate::{
|
||||||
pub use crate::option::Option::{self, None, Some}; // :option
|
marker::Sized, // :sized
|
||||||
|
option::Option::{self, None, Some}, // :option
|
||||||
|
result::Result::{self, Err, Ok}, // :result
|
||||||
|
};
|
||||||
}
|
}
|
||||||
|
|
||||||
pub mod rust_2015 {
|
pub mod rust_2015 {
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue