-
Notifications
You must be signed in to change notification settings - Fork 5.5k
Enable frozen_abi on banking trace file #33501
Changes from 1 commit
5e3a8a8
c875a1a
4a34a58
368d5a5
f5bdb30
56111b7
2230884
bd5e2cc
b564f05
fd6c28d
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
- Loading branch information
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -316,10 +316,20 @@ impl<T: AbiExample> AbiExample for std::sync::Arc<T> { | |
| } | ||
| } | ||
|
|
||
| // When T is weakly owned by the likes of `std::{sync, rc}::Weak`s, we need to uphold the ownership | ||
|
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Appreciate the explanation here. However, I'm not super clear on why we need to have the implementations for #[serde(skip)]
recycler: Weak<RecyclerX<PinnedVec<T>>>,so shouldn't this
Contributor
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
another good question. yeah, some unspoken nuances are lying here... ;) i did my best to answer that in patch: fd6c28d
yep, i noticed this bug in as you correctly pointed out, |
||
| // of T in some way at least during abi digesting... However, there's no easy way. Stashing them | ||
| // into static is confronted with Send/Sync issue. Stashing them into thread_local is confronted | ||
| // with not enough (T + 'static) lifetime bound.. So, just leak the examples. This should be | ||
| // tolerated, considering ::example() should ever be called inside tests, not in production code... | ||
| fn leak_and_inhibit_drop<'a, T>(t: T) -> &'a mut T { | ||
| Box::leak(Box::new(t)) | ||
| } | ||
|
|
||
| impl<T: AbiExample> AbiExample for std::sync::Weak<T> { | ||
| fn example() -> Self { | ||
| info!("AbiExample for (Weak<T>): {}", type_name::<Self>()); | ||
| std::sync::Arc::downgrade(&std::sync::Arc::new(T::example())) | ||
| info!("AbiExample for (Arc's Weak<T>): {}", type_name::<Self>()); | ||
| // leaking is needed otherwise Arc::upgrade() will always return None... | ||
| std::sync::Arc::downgrade(leak_and_inhibit_drop(std::sync::Arc::new(T::example()))) | ||
| } | ||
| } | ||
|
|
||
|
|
@@ -330,6 +340,14 @@ impl<T: AbiExample> AbiExample for std::rc::Rc<T> { | |
| } | ||
| } | ||
|
|
||
| impl<T: AbiExample> AbiExample for std::rc::Weak<T> { | ||
| fn example() -> Self { | ||
| info!("AbiExample for (Rc's Weak<T>): {}", type_name::<Self>()); | ||
| // leaking is needed otherwise Rc::upgrade() will always return None... | ||
| std::rc::Rc::downgrade(leak_and_inhibit_drop(std::rc::Rc::new(T::example()))) | ||
| } | ||
| } | ||
|
|
||
| impl<T: AbiExample> AbiExample for std::sync::Mutex<T> { | ||
| fn example() -> Self { | ||
| info!("AbiExample for (Mutex<T>): {}", type_name::<Self>()); | ||
|
|
||
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
as you can see, enabling frozen_abi for banking trace files wasn't so joyful... xD