mirror of
https://github.com/rust-lang/rust-analyzer.git
synced 2025-09-30 22:01:37 +00:00
replace horrible hack with a slightly less horrible one
This commit is contained in:
parent
2b69c84396
commit
35f1655b0b
2 changed files with 5 additions and 3 deletions
|
@ -32,11 +32,10 @@ pub trait CheckCanceled {
|
|||
|
||||
fn catch_canceled<F, T>(&self, f: F) -> Result<T, Canceled>
|
||||
where
|
||||
Self: Sized,
|
||||
Self: Sized + panic::RefUnwindSafe,
|
||||
F: FnOnce(&Self) -> T + panic::UnwindSafe,
|
||||
{
|
||||
let this = panic::AssertUnwindSafe(self);
|
||||
panic::catch_unwind(|| f(*this)).map_err(|err| match err.downcast::<Canceled>() {
|
||||
panic::catch_unwind(|| f(self)).map_err(|err| match err.downcast::<Canceled>() {
|
||||
Ok(canceled) => *canceled,
|
||||
Err(payload) => panic::resume_unwind(payload),
|
||||
})
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue