Skip to content

Commit

Permalink
Merge pull request #1273 from google/rvalueparamhandler-comment
Browse files Browse the repository at this point in the history
Add comment explaining RValueParamHandler.
  • Loading branch information
adetaylor authored Apr 14, 2023
2 parents e9a62b4 + 98fcc88 commit 994a0b1
Showing 1 changed file with 7 additions and 0 deletions.
7 changes: 7 additions & 0 deletions src/rvalue_param.rs
Original file line number Diff line number Diff line change
Expand Up @@ -78,6 +78,13 @@ unsafe impl<'a, T> RValueParam<T> for Pin<MoveRef<'a, T>> {
/// need to pass a value parameter into C++, and will take responsibility
/// for extracting that value parameter from the [`RValueParam`] and doing
/// any later cleanup.
///
/// Because C++ move constructors may modify the original object, we consume
/// the object and store it, pinned, until the call completes. This avoids any
/// risk that C++ will mutate objects elsewhere in Rust-land, which could cause
/// problems in the case of re-entrancy as references might exist to those
/// other objects and Rust assumes there are no unexpected mutations of objects
/// where references exist.
#[doc(hidden)]
pub struct RValueParamHandler<T, RVP>
where
Expand Down

0 comments on commit 994a0b1

Please sign in to comment.