1 //@ignore-target-windows: No libc on Windows
2 // We are making scheduler assumptions here.
3 //@compile-flags: -Zmiri-preemption-rate=0
5 // Joining itself is undefined behavior.
7 use std::{ptr, thread};
10 let handle = thread::spawn(|| {
12 let native: libc::pthread_t = libc::pthread_self();
13 assert_eq!(libc::pthread_join(native, ptr::null_mut()), 0); //~ ERROR: Undefined Behavior: trying to join itself
17 handle.join().unwrap();