You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Description
I was trying to catch_unwind in a project depending on Tokio's tokio::sync::Notify primitive, and ran into a compile error because Notify is not unwind safe.
I'm not sure if this is technically a bug or a feature request.
Compiling playground v0.0.1 (/playground)
error[[E0277]](https://doc.rust-lang.org/stable/error-index.html#E0277): the type `UnsafeCell<AtomicUsize>` may contain interior mutability and a reference may not be safely transferrable across a catch_unwind boundary
--> src/main.rs:5:5
|
5 | std::panic::catch_unwind(|| {
| ^^^^^^^^^^^^^^^^^^^^^^^^ `UnsafeCell<AtomicUsize>` may contain interior mutability and a reference may not be safely transferrable across a catch_unwind boundary
|
= help: within `Notify`, the trait `RefUnwindSafe` is not implemented for `UnsafeCell<AtomicUsize>`
= note: required because it appears within the type `tokio::loom::std::atomic_usize::AtomicUsize`
= note: required because it appears within the type `Notify`
= note: required because of the requirements on the impl of `UnwindSafe` for `&Notify`
note: required because it's used within this closure
--> src/main.rs:5:30
|
5 | std::panic::catch_unwind(|| {
| ^^
note: required by a bound in `catch_unwind`
error[[E0277]](https://doc.rust-lang.org/stable/error-index.html#E0277): the type `UnsafeCell<tokio::util::linked_list::LinkedList<tokio::sync::notify::Waiter, tokio::sync::notify::Waiter>>` may contain interior mutability and a reference may not be safely transferrable across a catch_unwind boundary
--> src/main.rs:5:5
|
5 | std::panic::catch_unwind(|| {
| ^^^^^^^^^^^^^^^^^^^^^^^^ `UnsafeCell<tokio::util::linked_list::LinkedList<tokio::sync::notify::Waiter, tokio::sync::notify::Waiter>>` may contain interior mutability and a reference may not be safely transferrable across a catch_unwind boundary
|
= help: within `Notify`, the trait `RefUnwindSafe` is not implemented for `UnsafeCell<tokio::util::linked_list::LinkedList<tokio::sync::notify::Waiter, tokio::sync::notify::Waiter>>`
= note: required because it appears within the type `lock_api::mutex::Mutex<parking_lot::raw_mutex::RawMutex, tokio::util::linked_list::LinkedList<tokio::sync::notify::Waiter, tokio::sync::notify::Waiter>>`
= note: required because it appears within the type `tokio::loom::std::parking_lot::Mutex<tokio::util::linked_list::LinkedList<tokio::sync::notify::Waiter, tokio::sync::notify::Waiter>>`
= note: required because it appears within the type `Notify`
= note: required because of the requirements on the impl of `UnwindSafe` for `&Notify`
note: required because it's used within this closure
--> src/main.rs:5:30
|
5 | std::panic::catch_unwind(|| {
| ^^
note: required by a bound in `catch_unwind`
For more information about this error, try `rustc --explain E0277`.
error: could not compile `playground` due to 2 previous errors
The text was updated successfully, but these errors were encountered:
Version
1.21.2
Platform
Rust playground and Linux, Ubuntu 20.04.
Description
I was trying to
catch_unwind
in a project depending on Tokio'stokio::sync::Notify
primitive, and ran into a compile error becauseNotify
is not unwind safe.I'm not sure if this is technically a bug or a feature request.
I tried this code:
https://play.rust-lang.org/?version=stable&mode=debug&edition=2021&gist=c1409cc70ceea71c7d28c41f7232e19c
I expected to see this happen: No compile error
Instead, this happened:
The text was updated successfully, but these errors were encountered: