mirror of
https://github.com/rust-lang/rust-analyzer.git
synced 2025-09-28 04:44:57 +00:00
extract_function does not move locals defined outside of loops
This commit is contained in:
parent
f55441f7ed
commit
01413dd7d4
2 changed files with 141 additions and 14 deletions
|
@ -17,6 +17,7 @@
|
|||
//! deref_mut: deref
|
||||
//! index: sized
|
||||
//! fn:
|
||||
//! try:
|
||||
//! pin:
|
||||
//! future: pin
|
||||
//! option:
|
||||
|
@ -266,6 +267,28 @@ pub mod ops {
|
|||
}
|
||||
pub use self::function::{Fn, FnMut, FnOnce};
|
||||
// endregion:fn
|
||||
// region:try
|
||||
mod try_ {
|
||||
pub enum ControlFlow<B, C = ()> {
|
||||
Continue(C),
|
||||
Break(B),
|
||||
}
|
||||
pub trait FromResidual<R = Self::Residual> {
|
||||
#[lang = "from_residual"]
|
||||
fn from_residual(residual: R) -> Self;
|
||||
}
|
||||
#[lang = "try"]
|
||||
pub trait Try: FromResidual<Self::Residual> {
|
||||
type Output;
|
||||
type Residual;
|
||||
#[lang = "from_output"]
|
||||
fn from_output(output: Self::Output) -> Self;
|
||||
#[lang = "branch"]
|
||||
fn branch(self) -> ControlFlow<Self::Residual, Self::Output>;
|
||||
}
|
||||
}
|
||||
pub use self::try_::{ControlFlow, FromResidual, Try};
|
||||
// endregion:try
|
||||
}
|
||||
|
||||
// region:eq
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue