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
$ cargo clippy
Checking rustls-ffi v0.10.0 (/home/jsha/rust/rustls-ffi)
error: usage of `Arc<T>` where `T` is not `Send` or `Sync`
--> src/lib.rs:396:23
|
396 | Arc::into_raw(Arc::new(src)) as *const _
| ^^^^^^^^^^^^^
|
= help: consider using `Rc<T>` instead or wrapping `T` in a std::sync type like `Mutex<T>`
= help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#arc_with_non_send_sync
= note: `#[deny(clippy::arc_with_non_send_sync)]` on by default
The relevant code is:
pub(crate) trait CastConstPtr {
type RustType;
fn cast_const_ptr(ptr: *const Self) -> *const Self::RustType {
ptr as *const _
}
}
pub(crate) trait CastConstPtr {
type RustType;
fn cast_const_ptr(ptr: *const Self) -> *const Self::RustType {
ptr as *const _
}
}
/// Anything that qualifies for CastPtr also automatically qualifies for
/// CastConstPtr. Splitting out CastPtr vs CastConstPtr allows us to ensure
/// that Arcs are never cast to a mutable pointer.
impl<T, R> CastConstPtr for T
where
T: CastPtr<RustType = R>,
R: Send,
{
type RustType = R;
}
pub(crate) trait ArcCastPtr: CastConstPtr + Sized + Send + Sync {
...
fn to_const_ptr(src: Self::RustType) -> *const Self {
Arc::into_raw(Arc::new(src)) as *const _
}
I think the clippy finding is a good one. Somewhere along the line we should probably be guaranteeing that the RustType for an ArcCastPtr is at least Send. I tried a couple of quick stabs at expressing this in the type system but haven't yet succeeded, so I'm filing this issue to track it.
The text was updated successfully, but these errors were encountered:
Currently
cargo clippy
produces this error:The relevant code is:
I think the clippy finding is a good one. Somewhere along the line we should probably be guaranteeing that the
RustType
for anArcCastPtr
is at leastSend
. I tried a couple of quick stabs at expressing this in the type system but haven't yet succeeded, so I'm filing this issue to track it.The text was updated successfully, but these errors were encountered: