mirror of
https://github.com/rust-lang/rust-analyzer.git
synced 2025-09-27 04:19:13 +00:00
⬆️ rust-analyzer
This commit is contained in:
parent
3a57388d13
commit
4f55ebbd4f
122 changed files with 2885 additions and 1093 deletions
|
@ -37,6 +37,7 @@
|
|||
//! add:
|
||||
//! as_ref: sized
|
||||
//! drop:
|
||||
//! generator: pin
|
||||
|
||||
pub mod marker {
|
||||
// region:sized
|
||||
|
@ -182,6 +183,19 @@ pub mod ops {
|
|||
type Target: ?Sized;
|
||||
fn deref(&self) -> &Self::Target;
|
||||
}
|
||||
|
||||
impl<T: ?Sized> Deref for &T {
|
||||
type Target = T;
|
||||
fn deref(&self) -> &T {
|
||||
loop {}
|
||||
}
|
||||
}
|
||||
impl<T: ?Sized> Deref for &mut T {
|
||||
type Target = T;
|
||||
fn deref(&self) -> &T {
|
||||
loop {}
|
||||
}
|
||||
}
|
||||
// region:deref_mut
|
||||
#[lang = "deref_mut"]
|
||||
pub trait DerefMut: Deref {
|
||||
|
@ -347,6 +361,27 @@ pub mod ops {
|
|||
fn add(self, rhs: Rhs) -> Self::Output;
|
||||
}
|
||||
// endregion:add
|
||||
|
||||
// region:generator
|
||||
mod generator {
|
||||
use crate::pin::Pin;
|
||||
|
||||
#[lang = "generator"]
|
||||
pub trait Generator<R = ()> {
|
||||
type Yield;
|
||||
#[lang = "generator_return"]
|
||||
type Return;
|
||||
fn resume(self: Pin<&mut Self>, arg: R) -> GeneratorState<Self::Yield, Self::Return>;
|
||||
}
|
||||
|
||||
#[lang = "generator_state"]
|
||||
pub enum GeneratorState<Y, R> {
|
||||
Yielded(Y),
|
||||
Complete(R),
|
||||
}
|
||||
}
|
||||
pub use self::generator::{Generator, GeneratorState};
|
||||
// endregion:generator
|
||||
}
|
||||
|
||||
// region:eq
|
||||
|
@ -455,6 +490,19 @@ pub mod pin {
|
|||
pub struct Pin<P> {
|
||||
pointer: P,
|
||||
}
|
||||
impl<P> Pin<P> {
|
||||
pub fn new(pointer: P) -> Pin<P> {
|
||||
loop {}
|
||||
}
|
||||
}
|
||||
// region:deref
|
||||
impl<P: crate::ops::Deref> crate::ops::Deref for Pin<P> {
|
||||
type Target = P::Target;
|
||||
fn deref(&self) -> &P::Target {
|
||||
loop {}
|
||||
}
|
||||
}
|
||||
// endregion:deref
|
||||
}
|
||||
// endregion:pin
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue