rust/tests/crashes/122909.rs

Ignoring revisions in .git-blame-ignore-revs. Click here to bypass and see the normal blame view.

16 lines
387 B
Rust
Raw Normal View History

//@ compile-flags: -Zvalidate-mir -Zinline-mir=yes
//@ known-bug: #122909
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>()))
}
}