From f4419dc416355bff18b5621c896acc1af7074597 Mon Sep 17 00:00:00 2001 From: 0x676e67 Date: Tue, 17 Jun 2025 20:22:42 +0800 Subject: [PATCH] revert(boring): Restore `src/x509/store.rs` to match upstream --- boring/src/x509/store.rs | 28 +++++++++++----------------- 1 file changed, 11 insertions(+), 17 deletions(-) diff --git a/boring/src/x509/store.rs b/boring/src/x509/store.rs index 2aea7d81..5d2ca99a 100644 --- a/boring/src/x509/store.rs +++ b/boring/src/x509/store.rs @@ -134,23 +134,6 @@ foreign_type_and_impl_send_sync! { pub struct X509Store; } -impl Clone for X509Store { - fn clone(&self) -> Self { - (**self).to_owned() - } -} - -impl ToOwned for X509StoreRef { - type Owned = X509Store; - - fn to_owned(&self) -> Self::Owned { - unsafe { - ffi::X509_STORE_up_ref(self.as_ptr()); - X509Store::from_ptr(self.as_ptr()) - } - } -} - impl X509StoreRef { /// **Warning: this method is unsound** /// @@ -175,3 +158,14 @@ impl X509StoreRef { self.objects().len() } } + +#[test] +#[allow(dead_code)] +// X509Store must not implement Clone because `SslContextBuilder::cert_store_mut` lets +// you get a mutable reference to a store that could have been cloned before being +// passed to `SslContextBuilder::set_cert_store`. +fn no_clone_for_x509store() { + trait MustNotImplementClone {} + impl MustNotImplementClone for T {} + impl MustNotImplementClone for X509Store {} +}