reentrant_init_deadlocks.rs 351 B

1234567891011121314
  1. fn main() {
  2. let cell = once_cell::sync::OnceCell::<u32>::new();
  3. cell.get_or_init(|| {
  4. cell.get_or_init(|| 1);
  5. 2
  6. });
  7. }
  8. /// Dummy test to make it seem hang when compiled as `--test`
  9. /// See https://github.com/matklad/once_cell/issues/79
  10. #[test]
  11. fn dummy_test() {
  12. std::thread::sleep(std::time::Duration::from_secs(4));
  13. }