mirror of
https://github.com/rust-lang/rust-analyzer.git
synced 2025-09-26 20:09:19 +00:00
⬆️ rust-analyzer
This commit is contained in:
parent
8536eb016c
commit
a99a48e786
86 changed files with 3149 additions and 1653 deletions
|
@ -8,36 +8,37 @@
|
|||
//! We then strip all the code marked with other flags.
|
||||
//!
|
||||
//! Available flags:
|
||||
//! sized:
|
||||
//! unsize: sized
|
||||
//! coerce_unsized: unsize
|
||||
//! slice:
|
||||
//! range:
|
||||
//! deref: sized
|
||||
//! deref_mut: deref
|
||||
//! index: sized
|
||||
//! fn:
|
||||
//! try:
|
||||
//! pin:
|
||||
//! future: pin
|
||||
//! option:
|
||||
//! result:
|
||||
//! iterator: option
|
||||
//! iterators: iterator, fn
|
||||
//! default: sized
|
||||
//! hash:
|
||||
//! clone: sized
|
||||
//! copy: clone
|
||||
//! from: sized
|
||||
//! eq: sized
|
||||
//! ord: eq, option
|
||||
//! derive:
|
||||
//! fmt: result
|
||||
//! bool_impl: option, fn
|
||||
//! add:
|
||||
//! as_ref: sized
|
||||
//! bool_impl: option, fn
|
||||
//! clone: sized
|
||||
//! coerce_unsized: unsize
|
||||
//! copy: clone
|
||||
//! default: sized
|
||||
//! deref_mut: deref
|
||||
//! deref: sized
|
||||
//! derive:
|
||||
//! drop:
|
||||
//! eq: sized
|
||||
//! fmt: result
|
||||
//! fn:
|
||||
//! from: sized
|
||||
//! future: pin
|
||||
//! generator: pin
|
||||
//! hash:
|
||||
//! index: sized
|
||||
//! infallible:
|
||||
//! iterator: option
|
||||
//! iterators: iterator, fn
|
||||
//! option:
|
||||
//! ord: eq, option
|
||||
//! pin:
|
||||
//! range:
|
||||
//! result:
|
||||
//! sized:
|
||||
//! slice:
|
||||
//! try: infallible
|
||||
//! unsize: sized
|
||||
|
||||
pub mod marker {
|
||||
// region:sized
|
||||
|
@ -150,6 +151,9 @@ pub mod convert {
|
|||
fn as_ref(&self) -> &T;
|
||||
}
|
||||
// endregion:as_ref
|
||||
// region:infallible
|
||||
pub enum Infallible {}
|
||||
// endregion:infallible
|
||||
}
|
||||
|
||||
pub mod ops {
|
||||
|
@ -326,7 +330,7 @@ pub mod ops {
|
|||
Continue(C),
|
||||
Break(B),
|
||||
}
|
||||
pub trait FromResidual<R = Self::Residual> {
|
||||
pub trait FromResidual<R = <Self as Try>::Residual> {
|
||||
#[lang = "from_residual"]
|
||||
fn from_residual(residual: R) -> Self;
|
||||
}
|
||||
|
@ -342,13 +346,13 @@ pub mod ops {
|
|||
|
||||
impl<B, C> Try for ControlFlow<B, C> {
|
||||
type Output = C;
|
||||
type Residual = ControlFlow<B, convert::Infallible>;
|
||||
type Residual = ControlFlow<B, crate::convert::Infallible>;
|
||||
fn from_output(output: Self::Output) -> Self {}
|
||||
fn branch(self) -> ControlFlow<Self::Residual, Self::Output> {}
|
||||
}
|
||||
|
||||
impl<B, C> FromResidual for ControlFlow<B, C> {
|
||||
fn from_residual(residual: ControlFlow<B, convert::Infallible>) -> Self {}
|
||||
fn from_residual(residual: ControlFlow<B, crate::convert::Infallible>) -> Self {}
|
||||
}
|
||||
}
|
||||
pub use self::try_::{ControlFlow, FromResidual, Try};
|
||||
|
@ -469,6 +473,33 @@ pub mod option {
|
|||
}
|
||||
}
|
||||
}
|
||||
// region:try
|
||||
impl<T> crate::ops::Try for Option<T> {
|
||||
type Output = T;
|
||||
type Residual = Option<crate::convert::Infallible>;
|
||||
|
||||
#[inline]
|
||||
fn from_output(output: Self::Output) -> Self {
|
||||
Some(output)
|
||||
}
|
||||
|
||||
#[inline]
|
||||
fn branch(self) -> crate::ops::ControlFlow<Self::Residual, Self::Output> {
|
||||
match self {
|
||||
Some(v) => crate::ops::ControlFlow::Continue(v),
|
||||
None => crate::ops::ControlFlow::Break(None),
|
||||
}
|
||||
}
|
||||
}
|
||||
impl<T> crate::ops::FromResidual for Option<T> {
|
||||
#[inline]
|
||||
fn from_residual(residual: Option<crate::convert::Infallible>) -> Self {
|
||||
match residual {
|
||||
None => None,
|
||||
}
|
||||
}
|
||||
}
|
||||
// endregion:try
|
||||
}
|
||||
// endregion:option
|
||||
|
||||
|
@ -584,7 +615,7 @@ pub mod iter {
|
|||
}
|
||||
}
|
||||
}
|
||||
pub use self::adapters::{Take, FilterMap};
|
||||
pub use self::adapters::{FilterMap, Take};
|
||||
|
||||
mod sources {
|
||||
mod repeat {
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue