aboutsummaryrefslogtreecommitdiff
path: root/src/cxx.cc
diff options
context:
space:
mode:
authorDavid Tolnay <dtolnay@gmail.com>2020-12-28 17:47:51 -0800
committerDavid Tolnay <dtolnay@gmail.com>2020-12-28 18:06:17 -0800
commit85b6bc4a39a68c5b064807e89f1933d898e0f5b6 (patch)
treee7a87a31e86e05c0841aec38e08c6abdc350f383 /src/cxx.cc
parent215e77fbec91468f294ea372f7c5524ed890de65 (diff)
downloadcxx-85b6bc4a39a68c5b064807e89f1933d898e0f5b6.tar.gz
Add downgrade conversion from SharedPtr to WeakPtr
Diffstat (limited to 'src/cxx.cc')
-rw-r--r--src/cxx.cc5
1 files changed, 5 insertions, 0 deletions
diff --git a/src/cxx.cc b/src/cxx.cc
index e573b446..2e1cc15b 100644
--- a/src/cxx.cc
+++ b/src/cxx.cc
@@ -520,6 +520,11 @@ static_assert(sizeof(std::string) <= kMaxExpectedWordsInString * sizeof(void *),
std::weak_ptr<CXX_TYPE> *ptr) noexcept { \
new (ptr) std::weak_ptr<CXX_TYPE>(self); \
} \
+ void cxxbridge1$std$weak_ptr$##RUST_TYPE##$downgrade( \
+ const std::shared_ptr<CXX_TYPE> &shared, \
+ std::weak_ptr<CXX_TYPE> *weak) noexcept { \
+ new (weak) std::weak_ptr<CXX_TYPE>(shared); \
+ } \
void cxxbridge1$std$weak_ptr$##RUST_TYPE##$drop( \
const std::weak_ptr<CXX_TYPE> *self) noexcept { \
self->~weak_ptr(); \