2024-08-03 13:11:31 -05:00
|
|
|
//@ compile-flags: -Zvalidate-mir -Zinline-mir=yes
|
2024-03-29 13:39:47 -05:00
|
|
|
//@ known-bug: #122909
|
2024-03-24 07:07:30 -05:00
|
|
|
|
|
|
|
|
|
|
|
use std::sync::{Arc, Context, Weak};
|
|
|
|
|
|
|
|
pub struct WeakOnce<T>();
|
|
|
|
impl<T> WeakOnce<T> {
|
|
|
|
extern "rust-call" fn try_get(&self) -> Option<Arc<T>> {}
|
|
|
|
|
|
|
|
pub fn get(&self) -> Arc<T> {
|
|
|
|
self.try_get()
|
|
|
|
.unwrap_or_else(|| panic!("Singleton {} not available", std::any::type_name::<T>()))
|
|
|
|
}
|
|
|
|
}
|