Skip to content

Commit c62c852

Browse files
cpujsha
authored andcommitted
lib: note BoxCastPtr/ArcCastPtr are mutually exclusive
1 parent 364655e commit c62c852

File tree

1 file changed

+4
-2
lines changed

1 file changed

+4
-2
lines changed

src/lib.rs

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -329,7 +329,8 @@ where
329329
}
330330

331331
// An implementation of BoxCastPtr means that when we give C code a pointer to the relevant type,
332-
// it is actually a Box.
332+
// it is actually a Box. At most one of BoxCastPtr or ArcCastPtr should be implemented for a given
333+
// type.
333334
pub(crate) trait BoxCastPtr: CastPtr + Sized {
334335
fn to_box(ptr: *mut Self) -> Option<Box<Self::RustType>> {
335336
if ptr.is_null() {
@@ -351,7 +352,8 @@ pub(crate) trait BoxCastPtr: CastPtr + Sized {
351352
}
352353

353354
// An implementation of ArcCastPtr means that when we give C code a pointer to the relevant type,
354-
// it is actually a Arc.
355+
// it is actually a Arc. At most one of BoxCastPtr or ArcCastPtr should be implemented for a given
356+
// // type.
355357
pub(crate) trait ArcCastPtr: CastConstPtr + Sized {
356358
/// Sometimes we create an Arc, then call `into_raw` and return the resulting raw pointer
357359
/// to C. C can then call rustls_server_session_new multiple times using that

0 commit comments

Comments
 (0)